Page 1 of 1

Try Catch Endcatch

Posted: Fri Jul 26, 2024 4:51 pm
by P_B
Hello,

To prevent a running program from stopping, it would be good if the developer could manage his own error messages, but also if the program did not stop.

Code: Select all

Try

  lines that can cause errors

Catch

  lines to execute on error

EndCatch
Thank you in advance

Re: Try Catch Endcatch

Posted: Fri Jul 26, 2024 5:49 pm
by Flinx
You have already such a mechanism. Look at 7.7 Error handling.
Example:

Code: Select all

Local err, id = ?OpenFile(Nil, "nonexistent")
If err<>#ERR_NONE
	DebugPrint("error")
Else
	DebugPrint("no error, id is", id)
EndIf

Re: Try Catch Endcatch

Posted: Fri Jul 26, 2024 8:05 pm
by P_B
Thank you Flinx for your help.