Error Handling (UI) - SingletonTheory/SingletonTheory.github.io GitHub Wiki
This page defines the way we handle errors in Singleton Theory. The outcomes of this should be a simple solution that is reusable across the application.
The $exceptionHandler from angular is overwritten in the ExceptionService.js file. This listens for all thrown errors and will handle the errors according to types as defined below.
This implementation is dependent on the utilitiesService to be injected into the areas where Error Handling occurs.
To throw an known error in the application do as follows:
throw utilitiesService.createKnownException(<<ErrorType>>, 'Error detected. Please contact the system administrator.', 'STACK : Error detected. Please contact the system administrator.');
To throw an un-known error just throw normally the exception handler will catch it and log to the console.
The known error types are defined as follows:
- Info
- KnownError
To set an error without throwing it in the application do as follows:
utilitiesService.setKnownException($rootScope, "The item already exist in the database!!");