Documents approaches to error handling.
The overall strategy of the system is to capture errors in lower levels of the system and throw them up to an application layer that can actually do something useful with it. In this case, that means handling errors at the REST service layer. An error handler is used to process all exceptions by writing a stack trace to a log, sending email to a configured list of administrators, and sending either an HTTP code 401 or 500 back to the client with an appropriate error message depending upon whether it is an authentication/authorization failure or an application failure.
A sophisticated exception hierarchy is not leveraged. Instead, most lower level calls merely throw Exception with the possibility that it is an application defined "LocalException". The only difference here is that LocalExceptions are guaranteed to contain user friendly error messages and do not need a stack trace pushed to the log. These are known conditions in the application that trigger errors that do not require additional layers of auditing or tracking. An example of this is an attempt to log in with an incorrect username or password - in this case the user merely needs to be informed of the condition and admins do not need to respond.
In order to have emails sent in response to application errors, a few properties must be configured in the config.properties file.
|mail.enabled||false||By default mail is disabled, this has to be specifically configured.|
|mail.smtp.user||n/a||The login for the mail server|
|mail.smtp.from||n/a||The "from" user for emails sent by the system.|
|mail.smtp.password||n/a||The user's mail server password|
The mail server host
|mail.smtp.port||n/a||The mail server port|
|mail.smtp.starttls.enable||n/a||A setting indicating that a TLS layer secures mail server communications|
A setting indicating that mail requests should be authenticated
|mail.smtp.to||n/a||The list of users who should receive email upon errors.|
NOTE: at the moment, the sending of email in the production deployment is specifically configured to support the IHTSDO style authenticated mail server. Non-encrypted email configurations are also supported.