How is it possibile to identify intentional exceptions (those that block reading or writing, for instance) from exceptions raised by Formwork? 

From version 1.25 you can associate to ALL THE EXCEPTIONS raised by the FormWork server an error handler that allows you to do so:





The error manager is a procedure in the library ('Global catch' in the previous screenshot) that, if associated with the system event 'On application error' is called each time that an exception occurs. 

The error manager signature has to be as follows:

 



Once the procedure is associated with the system event, it is summoned for each exception, which is passed as fourth topic. Inside the procedure, you can add any logic to distinguish the type of exception (application or system) or compensation/alerting actions. 

If you set the "handled" parameter to "True", you can treat the exception as managed and prevent the end-user from receiving error messages.

You can also use any class that comes from System.Exception for that parameter.

 

There are two ways to obtain a System.Exception:

  1. Catching an Exception
  2. Programmatically raising the exception