Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Is there a way to capture the line that caused and error

Reply
 
Old 12-23-2008   #1 (permalink)
Bob Smith


 
 

Is there a way to capture the line that caused and error

I have a function in my script which is an error logger. Many lines of code
call it and I log any errors thrown up by my script. I would like to also
record the line in the code that caused the specific error. This would be
similar to the message you get when cscript throws the error to the screen in
brackets. The only properties I know of for err are.

Err.Number
Err.Description
Err.Source

I tried Err.Line bit it didn't seem to work.


My System SpecsSystem Spec
Old 12-23-2008   #2 (permalink)
Richard Mueller [MVP]


 
 

Re: Is there a way to capture the line that caused and error


"Bob Smith" <BobSmith@xxxxxx> wrote in message
news:0CBF5B42-7310-44AF-8185-7F528FE7F57D@xxxxxx
Quote:

>I have a function in my script which is an error logger. Many lines of code
> call it and I log any errors thrown up by my script. I would like to also
> record the line in the code that caused the specific error. This would be
> similar to the message you get when cscript throws the error to the screen
> in
> brackets. The only properties I know of for err are.
>
> Err.Number
> Err.Description
> Err.Source
>
> I tried Err.Line bit it didn't seem to work.
>
The Err object has nothing that indicates the line number. The only solution
I can think of is to maintain your own line number or step number variable,
and pass this to your error function. A lot of work, but I've done this in
VB. However in VBScript I see no way to call your function, except to
repeatedly test Err.Number. If this is how you call your error function, you
can pass a different number in each call.

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Display error caused by usb key General Discussion
problem with the bluescreen error. caused by the wirless networkin Vista hardware & devices
WaitForExit() times out when I try to capture multi-line Stdout .NET General
error window caused by use of Start/Search Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46