Error Handling

When used from Java/JSP, Contenta throws exceptions when errors occur. The exceptions contain information about the error that occurred. SDL makes the following recommendations regarding error handling in custom CW code:

  • Trap all errors from Contenta and take appropriate action.
    • In most cases the original error should be displayed/logged in order to provide appropriate feedback to the user on the cause of the error. Common methods are provided in the CW API for logging.
  • Consider using a filtering method to filter the Contenta Web error messages to make them more user friendly.
    • SDL can provide what is used for Contenta Web
  • Make sure any necessary cleanup is done in catch blocks. Specifically, when using synchronization and the setTransactionOn and setTransactionOff methods, if setTransactionOn is called in the try block, make sure setTransactionOff is called in the catch block.