Hello,
I can't get custom error handling to work. I have the following line at the beginning of my source code:
RaiseOnError( p_MyError )
And later the p_MyError function, which displays my error message with the SystemRequest function.
When an error occurs (I cause the error by calling a function which doesn't exist), I get the standard Hollywood error message instead of my own message. What am I doing wrong?
How to use RaiseOnError?
Re: How to use RaiseOnError?
Place RaiseOnError() AFTER your p_MyError().
Re: How to use RaiseOnError?
Didn't help
I still get the build in Hollywood error message.
Re: How to use RaiseOnError?
Here is my test program:
When executed, it just pops up Hollywood's build in error message.
Code: Select all
Function p_MyError ( code, message$, command$, line )
DebugPrint ( "Code : ", code )
DebugPrint ( "Message: ", message$ )
DebugPrint ( "Command: ", command$ )
DebugPrint ( "Line : ", line )
EndFunction
RaiseOnError ( p_MyError )
/* Cause an error */
a = 1 / 0
WaitLeftMouse ()Re: How to use RaiseOnError?
You are correct, that particular error does not seem to work with RaiseOnError().
The rest of your code looks good; so if you replace a=1/0 with something like LoadBrush(1, ""), you will see RaiseOnError() work as it should.
The rest of your code looks good; so if you replace a=1/0 with something like LoadBrush(1, ""), you will see RaiseOnError() work as it should.
Re: How to use RaiseOnError?
Thanks PEB. I think I'll just disable Hollywood's error handler with ExitOnError ( False ). I was trying to make my program to close quietly when error occurs, but it looks like it cannot be done.
- airsoftsoftwair
- Posts: 5887
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: How to use RaiseOnError?
Currently, RaiseOnError() can only catch errors that are thrown by Hollywood functions. It's currently not possible to catch general lowlevel errors like division by zero or passing not enough arguments to functions etc. ExitOnError(False) is also not able to catch these lowlevel errors. I might extend this in the future to support all errors, though.
Re: How to use RaiseOnError?
That would be good.Andreas wrote:I might extend this in the future to support all errors, though.