473,394 Members | 1,641 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Error Handling

I have an error handling routine that emails me the Err.Source, Err.Nbr,
and Err.Description in the event of an error. How can I include the
line number of the error as well and the filename?

*** Sent via Developersdex http://www.developersdex.com ***
Oct 28 '05 #1
10 2696
How about something like this:

?????????????????????????????????????????????????? ????>?????????????????????????????????????>??????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????>???????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ????????????????????????????????>????????????????? ????..??????????????????.????????????????????????? ?????????????????????????????????????????????????? ????????????????????????????????????????????????>? ????????????????????....????????????

Ray at work

"John ." <jr****@yahoo.com> wrote in message
news:eY***************@TK2MSFTNGP09.phx.gbl...
I have an error handling routine that emails me the Err.Source, Err.Nbr,
and Err.Description in the event of an error. How can I include the
line number of the error as well and the filename?

*** Sent via Developersdex http://www.developersdex.com ***

Oct 28 '05 #2
Or try this understable reply. :| This particular code is meant for
displaying error data in a custom error page, but it'll give you info on
getting error information.
Dim aErrorInfo(1,13)
Dim oError
Set oError = Server.GetLastError

aErrorInfo(0,0) = "ASP Code" : aErrorInfo(1,0) = oError.ASPCode
aErrorInfo(0,1) = "ASP Description" : aErrorInfo(1,1) =
oError.ASPDescription
aErrorInfo(0,2) = "Description" : aErrorInfo(1,2) = oError.Description
aErrorInfo(0,3) = "Category" : aErrorInfo(1,3) = oError.Category
aErrorInfo(0,4) = "Number" : aErrorInfo(1,4) = oError.Number
aErrorInfo(0,5) = "Source" : aErrorInfo(1,5) = oError.Source
aErrorInfo(0,6) = "File" : aErrorInfo(1,6) = oError.File
aErrorInfo(0,7) = "Line" : aErrorInfo(1,7) = oError.Line
aErrorInfo(0,8) = "Querystring" : aErrorInfo(1,8) = Request.Querystring
On Error Resume Next
aErrorInfo(0,9) = "Form Data" : aErrorInfo(1,9) = Request.Form
If Err.Number <> 0 Then aErrorInfo(0,9) = "(binary data)"
On Error Goto 0
aErrorInfo(0,10) = "All HTTP" : aErrorInfo(1,10) = "<textarea
style=""width: 410px; height=100px; font: 8pt verdana;"">" &
Request.ServerVariables("ALL_HTTP") & "</textarea>"
aErrorInfo(0,11) = "Remote Address" : aErrorInfo(1,11) =
Request.ServerVariables("REMOTE_ADDR")
aErrorInfo(0,12) = "Description" : aErrorInfo(1,12) =
Request.ServerVariables("REMOTE_HOST")
aErrorInfo(0,13) = "Request Date" : aErrorInfo(1,13) = FormatDateTime(Now,
1) & " " & FormatDateTime(Now, 3)

Ray at work
"John ." <jr****@yahoo.com> wrote in message
news:eY***************@TK2MSFTNGP09.phx.gbl...
I have an error handling routine that emails me the Err.Source, Err.Nbr,
and Err.Description in the event of an error. How can I include the
line number of the error as well and the filename?

*** Sent via Developersdex http://www.developersdex.com ***

Oct 28 '05 #3
thanks costanza. i'll try that. i'm sure that will do the trick.

*** Sent via Developersdex http://www.developersdex.com ***
Oct 28 '05 #4
No problem Jonn.

Ray at work

"John ." <jr****@yahoo.com> wrote in message
news:ul****************@TK2MSFTNGP15.phx.gbl...
thanks costanza. i'll try that. i'm sure that will do the trick.

*** Sent via Developersdex http://www.developersdex.com ***

Oct 28 '05 #5

does this work for error codes below 100? i.e. type mismatches (13).

also, can the object be used as a parameter in a subroutine?
*** Sent via Developersdex http://www.developersdex.com ***
Oct 28 '05 #6
"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
message news:OH**************@TK2MSFTNGP15.phx.gbl...
Or try this understable reply. :| This particular code is meant for
displaying error data in a custom error page, but it'll give you info on
getting error information.
[snip]
"John ." <jr****@yahoo.com> wrote in message
news:eY***************@TK2MSFTNGP09.phx.gbl...
I have an error handling routine that emails me the Err.Source, Err.Nbr,
and Err.Description in the event of an error. How can I include the
line number of the error as well and the filename?


http://www.devguru.com/Technologies/...lasterror.html

"By default, the error information is sent to the
"\iishelp\common\500-100.asp" file."

Also, "Category" is another one.
Oct 28 '05 #7
Give it a try and see! http://www.aspfaq.com/5007

Ray at work

"John ." <jr****@yahoo.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...

does this work for error codes below 100? i.e. type mismatches (13).

also, can the object be used as a parameter in a subroutine?
*** Sent via Developersdex http://www.developersdex.com ***

Oct 28 '05 #8
I did and it didn't seem to do anything. I tried without passing as an
object and it didn't return any info about the error. Is the
GetLastError available in IIS 6.0 too?

*** Sent via Developersdex http://www.developersdex.com ***
Oct 29 '05 #9
http://www.aspfaq.com/5007

Yes. Show your code.

http://www.aspfaq.com/5007

Ray at work

"John ." <jr****@yahoo.com> wrote in message
news:ep*************@TK2MSFTNGP10.phx.gbl...
I did and it didn't seem to do anything. I tried without passing as an
object and it didn't return any info about the error. Is the
GetLastError available in IIS 6.0 too?

*** Sent via Developersdex http://www.developersdex.com ***

Oct 31 '05 #10

...
If (Err.number <> 0 ) Then
Set objASPError = Server.GetLastError()
Response.Write "Error Description: " & objASPError.Description
End If
...

When the error occurs "Error Description: " is the only thing written to
the screen.


*** Sent via Developersdex http://www.developersdex.com ***
Nov 2 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: WSeeger | last post by:
When creating a new class, is it encouraged to always include error handling routines within your LET and GET procedures? It's seems that most text books never seem to include much about error...
12
by: Christian Christmann | last post by:
Hi, assert and error handling can be used for similar purposes. When should one use assert instead of try/catch and in which cases the error handling is preferable? I've read somewhere that...
6
by: Squirrel | last post by:
I have a command button on a subform to delete a record. The only statement in the subroutine is: DoCmd.RunCommand acCmdDeleteRecord The subform's recordsource is "select * from tblVisit order...
13
by: Thelma Lubkin | last post by:
I use code extensively; I probably overuse it. But I've been using error trapping very sparingly, and now I've been trapped by that. A form that works for me on the system I'm using, apparently...
21
by: Anthony England | last post by:
Everyone knows that global variables get re-set in an mdb when an un-handled error is encountered, but it seems that this also happens when the variable is defined as private at form-level. So...
3
by: Stefan Johansson | last post by:
Hi all I'am moving from Visual Foxpro and have a question regarding "best practice" error handling in vb .net. In VFP I have always used a "central" error handling object in order to have a...
4
by: Al Williams | last post by:
Hi, I have error handling in place throughout my application. I also start the application wrapped in error handling code to catch any unexpected exceptions (i.e. exceptions that occur where I...
10
by: Anthony England | last post by:
(sorry for the likely repost, but it is still not showing on my news server and after that much typing, I don't want to lose it) I am considering general error handling routines and have...
0
by: Lysander | last post by:
Thought I would give something back with a few articles. This article is a bit of code to add error handling. When I have time, I want to write articles on multilingual databases, and Access...
9
by: MrDeej | last post by:
Hello guys! We have an SQL server which sometimes makes timeouts and connection errors. And we have an function witch writes and updates data in 2 tables on this server. When the SQL server error...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.