Error Handling and Recovery
- Informative error reports- trusted application code should handle all possible errors that might occur due to invalid usage of the trusted application. In addition it should return some usable errors to the host-side for further error handling. The correct way to do so is via the relevant methods for error passing . Using different errors and values for various cases and states is recommended mostly since the debugging capabilities in production setups are very limited!
- Handling exceptions– Besides the exceptions, which are defined in the relevant APIs, additional run-time exceptions might occur. These should be taken into account during reviews and validation (e.g. nullPointerException or ArrayOutOfBoundsException). In addition, verifying that call-back functions handle all exceptions is also recommended, since an exception there will not be caught by the trusted application if it is thrown from the scope of the call-back.