See Also: Explanation of user (handled) errors and unhandled errors in ErrorSystem class, Error, UserError
Retrieves the same message stack information you would see in your error dialog and places it in a string.
CallStackDump {StringVariable}
Where {StringVariable} is a variable of type String.
When an error is generated, The Error_Report event gets called, which may be used to customize error reporting. When customizing unhandled error reporting a special command, CallStackDump, is provided that allows you to retrieve the message stack information.
The CallStackDump command retrieves the same message stack information you would see in the error dialog and places it in a string. You can use this do other things with the error information, such as logging it to a file or sending an error report. The CallStackDump command should only be used within the error handler's Error_Report event.
The following example creates a replacement error handler that logs all unhandled errors. Because this is an example, the logging will simply display the error in the showln dialog.
Object oError is a ErrorSystem
Property Boolean pbInError False
Procedure Error_Report Integer iError Integer iLine String sErrMsg
String sStack
Boolean bUnhandled bBusy
// augment to log unhandled errors
Get pbInError to bBusy
If not bBusy Begin
Set pbInError to True
Get IsUnhandledError iError to bUnhandled
If bUnhandled Begin
CallStackDump sStack
Send LogUnhandledError iError iLine sErrMsg sStack
End
Set pbInError to False
End
// now do the normal error report.
Forward Send Error_Report iError iLine sErrMsg
End_Procedure
Procedure LogUnhandledError Integer iError Integer iLine String sErrMsg String sStack
Showln "Unhandled Error: " iError " at " iLine
Showln sErrMsg
Showln sStack
Showln
End_Procedure
// note: this line is only needed if using this error handler
// in objects or classes not derived from ErrorSystem
Move Self to Error_Object_Id
End_Object