Can I get the Error Line number with VBScript?

Results 1 to 3 of 3

Thread: Can I get the Error Line number with VBScript?

  1. #1
    Mauricio C Guest

    Default Can I get the Error Line number with VBScript?

    &nbsp;<BR><BR> Hello all, I&#039m working with the basic "error handling" in ASP using VBScript (On Error Resume Next) and that kind of stuff. is there any way to get the line number for the error? (and, NO, making a variable to store Var + 1 each line of the code is not an option)---<BR><BR> Thank you very much.<BR><BR>Xmurf.

  2. #2
    Join Date
    Dec 1969

    Default RE: Can I get the Error Line number with VBScript?

    With ASP 3, you have get last error<BR><BR><BR>To get the line number in VBS, I think you have to "turn off" your error handling :(<BR>The unhandled error will usualy give you the line number.

  3. #3
    Join Date
    Dec 1969

    Default RE: Can I get the Error Line number with VBScript?

    With Internet Explorer (I am using v5, don&#039t know if this works with earlier versions), for client-side code, you can get the line number from the following event code. Please note, what you&#039re interested in are the parameters passed to this function. They are passed automatically by IE. The stuff you do with them is up to you. Obviously, I have my own things I do (which you can ignore).<BR><BR>&#039============================= ==========================================<BR>&#03 9 This function is called automatically whenever a run-time error occurs<BR>&#039on the client&#039s browser. In such a case, a new browser window will be<BR>&#039opened to the DisplayClientErrors.ASP for debugging purposes.<BR>&#039<BR>&#039THIS WILL NOT WORK if the user&#039s IE Internet browser options are set to<BR>&#039allow script debugging!! If you have installed Visual Interdev on your<BR>&#039machine, script debugging was set to allow, so if you need to test this<BR>&#039code, you will have to go to your IE settings and change this option.<BR>&#039<BR>&#039Also, this function needs to be the first executable code in the<BR>&#039client-side scripts!<BR>&#039================================= ======================================<BR>Function window_onerror (sErrMessage, url, line)<BR> <BR> &#039Clear any pending timeouts so as to perhaps prevent<BR> &#039any subsequent errors from operations pending timeout.<BR> window.clearTimeout glTimeoutTimerID<BR> <BR> glErrNum = Err.number<BR> gsErrDesc = Err.description<BR> gsErrSource = Err.source<BR> <BR> gsErrMsg = "An Error Has Occurred in the page. System Error Message: "<BR> gsErrMsg = gsErrMsg & sErrMessage & ". Error occurred on line: " & line<BR><BR> &#039Disable normal browser error handling of this event. In other words, disable<BR> &#039the display to the user of the normal IE dialog box (or little "Error<BR> &#039On Page" icon on the status line).<BR> window_onerror = True<BR><BR> window.setTimeout "HandleClientError", 1<BR> <BR>End Function<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts