Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 18,574 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
adding an error-case function #274928
06/29/09 09:06
06/29/09 09:06
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
Hi,

would it be possible to add a function that is called whenever an error occurs?

For example there would be a function prototype errorFct() that could be overridden by an implementation and is called whenever an error occurs so that we could add some additional debugging code. It would be great if that function could be called before the error popup is displayed.

Regards,
Pegamode.

Re: adding an error-case function [Re: pegamode] #274935
06/29/09 10:06
06/29/09 10:06
Joined: Jul 2000
Posts: 28,024
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,024
Frankfurt
I don't know a situation where an error handler would make much sense. Errors are caused either by bugs in the script, or by wrong external files. Bugs in the script must be fixed; an error handling function won't help better than the error message. Script crashes are caught with the C++ "try/catch" mechanism, which won't give you more info about the crash as you already have in the error message.

Wrong or missing external files normally won't cause an error message unless they are essential for continuing the program. Otherwise, the function using them just returns an error value, usually 0, that you can evaluate in the script. A general error handler for this type of errors will tell you less than when you evaluate the return values.

Re: adding an error-case function [Re: jcl] #274936
06/29/09 10:15
06/29/09 10:15
Joined: Sep 2003
Posts: 9,859
F
FBL Offline
Senior Expert
FBL  Offline
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
a try/catch is always useful when working with data coming from external, like e.g. parsing a file.

I really missed a try/catch mechanism when I wrote my XML parser in Lite-C...

Re: adding an error-case function [Re: FBL] #274937
06/29/09 10:29
06/29/09 10:29
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
I agree: "Bugs in the script must be fixed" ... but that's the point. I think such an error handler could help to analyze the error and with that to fix it.
For example sometimes it would be very useful to get a list of all currently running functions when an error occurs. This could be done in such an error handler function.

b.t.w. a try/catch mechanism in lite-c would be great, too.

Last edited by pegamode; 06/29/09 11:04.
Re: adding an error-case function [Re: pegamode] #275466
07/01/09 12:40
07/01/09 12:40
Joined: Jul 2008
Posts: 894
T
TechMuc Offline
User
TechMuc  Offline
User
T

Joined: Jul 2008
Posts: 894
Please implement such an on_error method!
This would allow to work out a stackwalk to catch eventual DLL-Errors with the correct(!!) function name.


Moderated by  aztec, Spirit 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1