Re: Err.Description does not contain the full text of the error me

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



The libraries are all in VBScript. Here is another little snippet to
demonstrate the problem. In this case, we are explicitly redeclaring a
constant, which will throw an error. Again, when we wrap our execute call in
error handling, the error description is "Name redefined", but if we allow
WSH to handle it the error description is "Name redefined: 'FOO'". Once
again, the WSH default error handler surfaces more information then is
contained in the Err object

<code>
Option Explicit

On Error Resume Next
Const FOO = 1
Execute "Const FOO = 2"

If Err <> 0 Then
MsgBox Err.Description
Err = 0
End If
On Error Goto 0

Execute "Const FOO = 3"
</code>

"Richard Mueller [MVP]" wrote:

Are the libraries you refer to in another language, maybe something you
cannot alter? If an error is encountered it passes the error back to your
script, but you don't get a line number (except the line in your script)?

The discrepancy surprises me. I was not aware of it. I'm glad I have never
found a similar problem in VB, although this particular example cannot
happen in VB, as the code will not compile or run in debug until the error
this fixed. I can't think of any solution.

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



.



Relevant Pages