Expand/Shrink

crash_message

Definition: crash_message(string s)
Description: Specify a string, s, to be printed on the screen in the event that Phix must stop your program due to a compile-time or run-time error.
pwa/p2js: Not (yet) supported.
Comments: Normally Phix prints a diagnostic message such as "syntax error" or "divide by zero" on the screen, as well as dumping debugging information into ex.err. While plain english to the average programmer, such messages are unlikely to be meaningful for your users unless they also happen to be Phix programmers. By calling crash_message() you can control the message that will appear on the screen. Debugging information is still be stored in the ex.err file. You do not lose any information by doing this.

s may contain '\n', new-line characters, so your message can span several lines on the screen. Phix will switch to the top of a clear text-mode screen before printing your message.

You can call crash_message() as many times as you like from different parts of your program. The message specified by the last call will be the one displayed.
Example:
crash_message("An unexpected error has occurred!\n" &
              "Please contact john_doe@whoops.com\n" &
              "Do not delete the file \"ex.err\".\n")
Implementation: via :%pCrashMsg in builtins\VM\pDiag.e (an autoinclude) - be warned however it is low-level complicated stuff that you do not need to know.
See Also: abort, crash_file, debugging and profiling