PDA

View Full Version : Can't Return Line Number of Error


robertdavies
09-29-2004, 12:40 AM
Hi

I am creating some error trapping code that will email me when a error occurs in asp code. Alot of

the code works, except perhaps one of the most vital pieces of information line number of the error

I have tried

ASPError.Line

&

set objErr=Server.GetLastError()
objErr.Line

&

Err.Line

I get nothing returned or the object im looking at, or it is errorous. Im using IIS 6. Does anyone

have any ideas of how to get the line number of an error? You would think it would be a important

thing to be able to return and simple too.

Thanks in advance for any help
Rob

Roy Sinclair
09-29-2004, 07:47 PM
If the line number is there it'll be in the err.description or the err.source property. The err.number property will be the number of the error.

robertdavies
09-30-2004, 12:04 AM
Hi thanks for that.

However it never seems to return the line number. as you know the line number is very important to tracking down what error has actually occured.

does anyone have any ideas?

BuddhaMan
09-30-2004, 07:05 AM
According to the third example down on the following page, the only way to know the line number is to hard code it yourself in custom errors.

http://www.4guysfromrolla.com/webtech/021201-1.shtml

err.source returns the error's class name or programmatic ID, not a line number.

reference:
http://www.devguru.com/Technologies/vbscript/quickref/err_source.html

glenngv
09-30-2004, 07:54 AM
The ASPError object is implemented in ASP 3.0 (IIS5).
It has the Line property that returns the line number of the error. Does it really return nothing in your case?

Could you try this and then tell us the output?

<%
dim objErr
set objErr=Server.GetLastError()

response.write("ASPCode=" & objErr.ASPCode)
response.write("<br />")
response.write("ASPDescription=" & objErr.ASPDescription)
response.write("<br />")
response.write("Category=" & objErr.Category)
response.write("<br />")
response.write("Column=" & objErr.Column)
response.write("<br />")
response.write("Description=" & objErr.Description)
response.write("<br />")
response.write("File=" & objErr.File)
response.write("<br />")
response.write("Line=" & objErr.Line)
response.write("<br />")
response.write("Number=" & objErr.Number)
response.write("<br />")
response.write("Source=" & objErr.Source)
%>