Error handling
Exceptional (unrecoverable) errors
Simplygon API reports exceptional errors through the error handling class ErrorHandler. A user can derive a class from ErrorHandler, which then will receive processing errors, and handle them appropriately. Any internal standard exception (such as null-pointer exception or out of memory exceptions etc) is reported through the same error handler. In C# and Python, if no error handler is set, the errors are reported through exception handling.
Please note that if you receive an exceptional error, the library is placed in an exceptional state. The safest way to handle this is to shut down and unload/reload the library before continuing. Failing to do this might affect the quality of the processing, and will lead to memory leaks.
Recoverable processing errors
A lot of processing errors are recoverable, and the user can safely continue processing, or try reprocessing with new data.
These errors are instead reported through the log and in return values from the Run methods in e.g. processing objects, casters or pipelines.
To instead have all errors be reported through the ErrorHandler, please set the global setting ReportErrorCodesToErrorHandler to true.
ErrorHandler example
Here is an error event example.