Error handling
Author: jheffez1
Creation Date: 6/29/2008 5:36 PM
profile picture

jheffez1

#1
I'm using WL5.0. I have a script that is the "central alert" mechanism which uses the global object pool to receive the alerts example: str = (string) GetGlobal(alertstr);

The problem is the first time I run it - this var is not declard and I get "Object reference not set to an instance of an object". So I have to cheat and run the following line first: SetGlobal( alertstr, "" );
Once I run it I can remark it and rerun the script for as long as WL5 is running. I wanted to set a try/catch condition that will run the above line in case of error. i.e.,

CODE:
Please log in to see this code.



But it's not working. I keep getting the same error above. Please help.
profile picture

Eugene

#2
1. Have you tried checking for a null value in the GOP?
CODE:
Please log in to see this code.


2. alertstr is a key and therefore should be a string i.e. "alertstr".
profile picture

jheffez1

#3
I tried the null checking code. Same problem. WL5 fires the error as soon as the "string str = (string) GetGlobal("alertstr");" command is executed. What I see as a 'bug' with WL5 is its inability to honor the try/catch error handling commands.

Was anyone able to use try/catch error handling or is it a known issue with WL5?
profile picture

Eugene

#4
Try/catch blocks are just great with WL5 - we've been using them for months:

Example #1: February 2008
Example #2: January 2008

It's just an error somewhere in the code, please provide a sample sufficient for troubleshooting.