Here is a really neat solution I've come up with for handling errors elegantly and how to fail to cleanup or continue while being obvious, unobtrusive, and simple to use!
One thing I wish I could do would be to use function overloading for all basic types and type-check them inside the procedure. But I know that just won't happen.

Code: Select all
#Fatal=1
Procedure SendError(ErrMsg.s,Fatal)
MessageRequester("Application Name - Error",ErrMsg.s)
If Fatal
; Perform cleanup
End
EndIf
EndProcedure
Procedure FAILED(Var,ErrMsg.s,Fatal)
If Not Var
SendError(ErrMsg.s,Fatal)
ProcedureReturn 1
EndIf
EndProcedure
FileID=ReadFile(#PB_Any,"C:\NonExistantFile.ext")
If FAILED(FileID,"Couldn't open the file!",#Fatal)
; Do something here if the error is not fatal
EndIf
Debug 2 ; Not run