User Tools

Site Tools


listing_20the_20line_20an_20error_20occurs_20in_20on_20error

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

listing_20the_20line_20an_20error_20occurs_20in_20on_20error [2018/03/31 13:19]
127.0.0.1 external edit
listing_20the_20line_20an_20error_20occurs_20in_20on_20error [2018/04/17 16:57] (current)
tbest3112 Added syntax highlighting
Line 2: Line 2:
  
 //by Jon Ripley, May 2011//\\ \\  The [[/​Detokeniser|detokeniser function]] documented on this wiki allows us to write an **ON ERROR** statement that lists the source code of the errant line when an error occurs. The FNErrorLine function returns the source code of the line the last error occurred in.\\ \\  The following ON ERROR handler prints the error followed by the line of code it occurred in:\\  //by Jon Ripley, May 2011//\\ \\  The [[/​Detokeniser|detokeniser function]] documented on this wiki allows us to write an **ON ERROR** statement that lists the source code of the errant line when an error occurs. The FNErrorLine function returns the source code of the line the last error occurred in.\\ \\  The following ON ERROR handler prints the error followed by the line of code it occurred in:\\ 
 +<code bb4w>
         ON ERROR ON ERROR OFF:PRINT REPORT$":​ "​FNErrorLine:​END         ON ERROR ON ERROR OFF:PRINT REPORT$":​ "​FNErrorLine:​END
 +</​code>​
 The full code for FNErrorLine including the [[/​Detokeniser|detokeniser]] is as follows:​\\ ​ The full code for FNErrorLine including the [[/​Detokeniser|detokeniser]] is as follows:​\\ ​
 +<code bb4w>
         DEF FNErrorLine         DEF FNErrorLine
         LOCAL I%,P%,line$ : I% = !408 : P% = PAGE         LOCAL I%,P%,line$ : I% = !408 : P% = PAGE
Line 60: Line 63:
         NEXT i%         NEXT i%
         =O$         =O$
 +</​code>​
listing_20the_20line_20an_20error_20occurs_20in_20on_20error.txt ยท Last modified: 2018/04/17 16:57 by tbest3112