Error Handling in Agents and Custom User Interfaces

When an agent cannot complete an operation, the operation method throws an exception. The error result propagates back through the server to the browser GUI. Code your agent and custom GUI so that errors help the user understand and correct the problem.

Consider these recommendations as you design and code your agent's handling of errors in operation calls:
  • Code operation methods to throw appropriate and helpful exceptions.
    • Choose the exception class that best characterizes the situation.
    • Choose an HTTP status code that gives useful information.
    • In the error string, explain the reason the operation could not complete correctly, and suggest recovery strategies for the end user.
    • Use wording that end users understand.
  • Code custom GUI elements to extract error information:
    • Extract the HTTP status code. The GUI can use it to select an appropriate response action.
    • Extract the error string. The GUI can display it to the user.
  • Code custom GUI elements to respond appropriately to errors. Consider these possible responses:
    • Display the error string.
    • Display other information.
    • Navigate to a different GUI page. For example, if the managed object that the current page represents no longer exists, consider navigating to a page that lists all objects of its type.
    • Let the user choose from a set of recovery options.