RaiseError()
Syntax
RaiseError(ErrorNumber)Description
Artificially create the given error. The appropriate error action will be taken (call of the error handler or program termination by the system if no handler is set). The ErrorNumber will be available inside the error handler with the ErrorCode() command.
Parameters
On Windows, any error number can be raised (even application defined ones). On Linux or Mac OSX, only the following errors can be raised:#PB_OnError_InvalidMemory : Read or write operation on an invalid location #PB_OnError_Floatingpoint : Floating point error #PB_OnError_Breakpoint : Debugger breakpoint reached (non-PureBasic breakpoints) #PB_OnError_IllegalInstruction : Attempt to execute an illegal instruction #PB_OnError_PriviledgedInstruction: Attempt to execute a priviledged (system-) instructionExample:
Procedure ErrorHandler() MessageRequester("OnError test", "The following error happened: " + ErrorMessage()) EndProcedure MessageRequester("OnError test", "Test start") OnErrorCall(@ErrorHandler()) RaiseError(#PB_OnError_InvalidMemory) MessageRequester("OnError test", "This should never be displayed")
Supported OS
All