Am I correct that VBScript does not support Error()? And that if you don't
capture the value of Err.Description that your SOL when it come to needing a
get the description of an error when you only have the code.

Re: Get Error Description from Number by ekkehard

ekkehard
Wed Sep 05 00:22:12 PDT 2007

dch3 schrieb:
> Am I correct that VBScript does not support Error()? And that if you do=
n't=20
> capture the value of Err.Description that your SOL when it come to need=
ing a=20
> get the description of an error when you only have the code.=20
Kind of brutal, but:

Function toErrDescr( nErr )
On Error Resume Next
Err.Raise nErr
toErrDescr =3D Err.Description
On Error GoTo 0
End Function

Dim nErr
For Each nErr In Array( 481, 52 )
WScript.Echo nErr, toErrDescr( nErr )
Next

=3D=3D>
=3D=3D=3D getErrDescr: get description from Err.Number =3D=3D=3D
481 Ung=C3=BCltiges Bild
52 Ung=C3=BCltige(r) Dateiname oder -nummer.
=3D=3D=3D getErrDescr: 0 done (00:00:00) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D




Re: Get Error Description from Number by dch3

dch3
Wed Sep 05 04:02:01 PDT 2007

While technically correct, that doesn't answer my question. Do you work for
Microsoft?

[b]Is the ERROR() function supported by VBScript?[/b]

I had already played with raising the err and then trapping the description
from the error object.

"ekkehard.horner" wrote:

> dch3 schrieb:
> > Am I correct that VBScript does not support Error()? And that if you don't
> > capture the value of Err.Description that your SOL when it come to needing a
> > get the description of an error when you only have the code.
> Kind of brutal, but:
>
> Function toErrDescr( nErr )
> On Error Resume Next
> Err.Raise nErr
> toErrDescr = Err.Description
> On Error GoTo 0
> End Function
>
> Dim nErr
> For Each nErr In Array( 481, 52 )
> WScript.Echo nErr, toErrDescr( nErr )
> Next
>
> ==>
> === getErrDescr: get description from Err.Number ===
> 481 Ungültiges Bild
> 52 Ungültige(r) Dateiname oder -nummer.
> === getErrDescr: 0 done (00:00:00) =================
>
>
>
>

Re: Get Error Description from Number by Richard

Richard
Wed Sep 05 06:14:48 PDT 2007

The Error function is not available in VBScript. The Err object is.

--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--

"dch3" <dch3@discussions.microsoft.com> wrote in message
news:D8125B31-925C-4C8E-8974-0AE5A4D8CDE4@microsoft.com...
> While technically correct, that doesn't answer my question. Do you work
> for
> Microsoft?
>
> [b]Is the ERROR() function supported by VBScript?[/b]
>
> I had already played with raising the err and then trapping the
> description
> from the error object.
>
> "ekkehard.horner" wrote:
>
>> dch3 schrieb:
>> > Am I correct that VBScript does not support Error()? And that if you
>> > don't
>> > capture the value of Err.Description that your SOL when it come to
>> > needing a
>> > get the description of an error when you only have the code.
>> Kind of brutal, but:
>>
>> Function toErrDescr( nErr )
>> On Error Resume Next
>> Err.Raise nErr
>> toErrDescr = Err.Description
>> On Error GoTo 0
>> End Function
>>
>> Dim nErr
>> For Each nErr In Array( 481, 52 )
>> WScript.Echo nErr, toErrDescr( nErr )
>> Next
>>
>> ==>
>> === getErrDescr: get description from Err.Number ===
>> 481 Ungültiges Bild
>> 52 Ungültige(r) Dateiname oder -nummer.
>> === getErrDescr: 0 done (00:00:00) =================
>>
>>
>>
>>



Re: Get Error Description from Number by Paul

Paul
Wed Sep 05 10:01:01 PDT 2007


"dch3" <dch3@discussions.microsoft.com> wrote in message
news:D8125B31-925C-4C8E-8974-0AE5A4D8CDE4@microsoft.com...
> While technically correct, that doesn't answer my question. Do you work
> for
> Microsoft?
>
> [b]Is the ERROR() function supported by VBScript?[/b]

Questions like this are difficult to answer because the question is so
poorly worded.
For all I know, there may be 100 languages with a "ERROR() function", but
you give us no clues as to what language that might be. Of course, any
ERROR() function a person correctly writes in VBScript by definition IS
supported. If VBScript had a built-in function with that name, how would we
compare it to some similarly named function in your unnamed language?

-Paul Randall