This shows you the differences between two versions of the page.
verbose_20error_20messages [2018/03/31 13:19] 127.0.0.1 external edit |
verbose_20error_20messages [2018/04/17 19:25] (current) tbest3112 Added syntax highlighting |
||
---|---|---|---|
Line 2: | Line 2: | ||
//By J.G.Harston, July 2009//\\ The **REPORT** command reports the last program error. It can make error messages more informative if you also display a message telling the user what action caused the error. A simple way to do this is to set and clear a variable around actions, and display this message as part of the error handler. For instance, the following error handler:\\ \\ | //By J.G.Harston, July 2009//\\ The **REPORT** command reports the last program error. It can make error messages more informative if you also display a message telling the user what action caused the error. A simple way to do this is to set and clear a variable around actions, and display this message as part of the error handler. For instance, the following error handler:\\ \\ | ||
+ | <code bb4w> | ||
doing$="":ON ERROR REPORT:PRINTdoing$:doing$="" | doing$="":ON ERROR REPORT:PRINTdoing$:doing$="" | ||
+ | </code> | ||
will display the contents of **doing$** after the error message. If you then use code along the following lines:\\ \\ | will display the contents of **doing$** after the error message. If you then use code along the following lines:\\ \\ | ||
+ | <code bb4w> | ||
DEF PROCsave(F$) | DEF PROCsave(F$) | ||
doing$=" saving """+F$+"""" | doing$=" saving """+F$+"""" | ||
Line 9: | Line 12: | ||
doing$="" | doing$="" | ||
ENDPROC | ENDPROC | ||
+ | </code> | ||
then if that code generates an error (eg Bad filename, Disk full, etc), then the displayed error message will be of the form:\\ \\ | then if that code generates an error (eg Bad filename, Disk full, etc), then the displayed error message will be of the form:\\ \\ | ||
Disk full saving "fred" | Disk full saving "fred" |