Errors Not Thrown From Internal Event Functions (Onlbuttonup)


SteveMyres

Recommended Posts

I have some script in OnLButtonUp(), which didn't do what I expected, but which didn't throw any error messages   The issue turned out to be that due to some other edits, there was no longer a declaration nor assignment for one of the variables used.

 

So in a typical sequence this would have given a "Channel or function not found" error, but none was shown.   Do the internal functions not throw error messages?

 

If not, then if I need to see the error messages, can I just move the code to another function and call that one from the internal function?  Or would that behavior apply to everything in that call hierarchy?

Link to comment
Share on other sites

Its easier to simply throw a try/catch block around the whole thing:

 

try

   // your code here

catch()

   ? strLastError

endcatch

 

Part of the reason for no error messages by default on these functions is that these events get run often, especially MouseMove, and if you have errors and a message is displayed you'd get thousands of messages in a few instants which would bog down the system.

Link to comment
Share on other sites

I thought that might be the reason, and yeah, I'd even be real careful what code was put in OnMouseMove(), if any.

 

Hadn't thought of using a try/catch block (though if I had I might have assumed that wouldn't work any place alerts wouldn't work in general).

 

Good idea, thanks!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.