Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: Ask Reuben 16 - When Things Go Wrong - Part 3 of 3 - Exception Handling  (Read 5830 times)
Reuben B.
Four Js
Posts: 1116


« on: May 05, 2020, 06:54:54 am »

In this third part of a three part series dealing with how you can handle errors gracefully whilst at the same time capturing as much information as possible, this article looks at Exception Handling.

Rather than displaying a system generated dialog or stopping with no UI at all, you can configure exception handling to always call a particular function by use of the WHENEVER ANY ERROR CALL function-name directive.  When a trappable exception occurs, your function is then called, and in it you can display a nice UI to the user and perform some other background tasks before the program stops.  This can include recording the fact that the program has ended with an exception. 

if you want to ignore an exception and carry on then you can use the TRY/CATCH block.  In the event of an exception inside the TRY block, the CATCH block will be executed and the program will then continue after the CATCH block.

Read more at https://4js.com/ask-reuben/ig-16/

Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines