Sofia
Wed Aug 16 14:30:03 CDT 2006
Hi! :)
Replies below.
Thanks! :)
/Sofia
"ekkehard.horner" <ekkehard.horner@arcor.de> wrote in message
news:44e356be$0$6985$9b4e6d93@newsspool1.arcor-online.net...
> Richard Mueller wrote:
>> Sofia Engvall wrote:
>>
>>
>>>I want to return the err object from a function. How do I do this?
>>>
>>>Do I have to create my own error class or is there a way to create an
>>>instance/copy of the existing to return?
>>>
>>>Thanks a million! :)
>
> Awhile ago I posted some demo code (Topic "Error handling bug on
> GetObject?");
> perhaps this could you give some hints.
I found the topic at:
http://www.tutorialsall.com/VBSCRIPT/Error-handling-193562/.
From here: "21: saveErr = Array( Err.Number, Err.Source,
Err.Description )"
Are you suggesting that I put Err in an array?
If you read a few rows up you see that I intend to make my own small error
class (not more than a simple struct) if what I'm asking for help about
can't be done.
It's not very nice to send people to read that much without reading their
question first. Thanks anyway! :)
>> Hi,
>>
>> You can use the Raise method of the error object to raise your own error.
>> I believe the syntax is:
>>
>> Err.Raise(intNumber, "your source", "your description")
>
> complete list of params according to the VBScript Docs:
> object.Raise(number, source, description, helpfile, helpcontext)
> (all params except number are optional)
I'm not interested in raising errors. :)
> the correct call would be:
> object.Raise number, source, description, helpfile, helpcontext
> NO param list () in VBScript Sub calls!
I also (as Richard's example) use paranteses around the arguments. I think
it makes the code easier to read. You have to live with writing Call before
the function/sub name but I prefer it to no paranteses anyway. :)
>> where intNumber is your error number. The error condition is maintained
>> until:
>>
>> Err.Clear
>> On Error GoTo 0
>> On Error Resume Next
>>
>> or a new error is raised.
>>