--- title: "ON ERROR" type: "article" slug: "on-error" url: "http://localhost/article/on-error/" markdown_url: "http://localhost/article/on-error.md" published_at: "2026-01-25T20:16:11+00:00" modified_at: "2026-06-21T23:37:03+00:00" featured_image: url: "http://localhost/wp-content/uploads/2022/04/20230809-041332.jpg" excerpt: "This utility is mostly used for error trapping on the Spectrum but can be used on a TS2068 also. It features 2 modes: On Error - Go to and On Error - Continue. The codes are completely relocatable and are 123 bytes long. To load these codes just CLEAR base-1 (if over 23756): LOAD \"ON…" category: - name: "Byte Power" slug: "byte-power" taxonomy: "category" url: "http://localhost/category/periodicals/byte-power/" post_tag: - name: "Full Text" slug: "fulltext" taxonomy: "post_tag" url: "http://localhost/tag/fulltext/" - name: "TS 2068" slug: "ts2068" taxonomy: "post_tag" url: "http://localhost/tag/ts2068/" model: - name: "Timex/Sinclair 2068" slug: "ts-2068" taxonomy: "model" url: "http://localhost/model/ts-2068/" indiv: - name: "Kristian Boisvert" slug: "boisvert-kristian" taxonomy: "indiv" url: "http://localhost/indiv/boisvert-kristian/" publication_r: id: 38570 title: "Byte Power 1st Class Magazine" type: "periodical" url: "http://localhost/periodical/byte-power-1st-class/" authors_r: - name: "Kristian Boisvert" slug: "boisvert-kristian" taxonomy: "indiv" url: "http://localhost/indiv/boisvert-kristian/" issues_articles: - id: 38580 title: "Byte Power May 1988" type: "issue" url: "http://localhost/issue/byte-power-10/" pubdate: "May 1988" archive_link: true --- # ON ERROR This utility is mostly used for error trapping on the Spectrum but can be used on a TS2068 also. It features 2 modes: On Error – Go to and On Error – Continue. The codes are completely relocatable and are 123 bytes long. To load these codes just CLEAR base-1 (if over 23756): LOAD “ON ERROR”CODE base (address to be loaded at). To use the ON ERROR: ``` GOTO:10 RANDOMIZE line # (where to go if error occurs) 20 RANDOMIZE USR base ``` And then you’re all set. Now if an error occurs, it will be trapped and go to the line indicated in the 1st RANDOMIZE. To use the ON ERROR: ``` CONTINUE:10 RANDOMIZE 10000 (over 9999) 20 RANDOMIZE USR base ``` What this will do is continue even if there is an error (break, stop, or tape error) if any other than those (variable not found, nonsense in basic, etc.) the program might crash. This is normal since it always sees an error it will go into a loop. To turn off the ON ERROR: ``` 10 RANDOMIZE USR (base+2) ``` (Line numbers are just examples, they may be changed to suit your needs.)