Extracting Error Information in the GUI

Code your custom UI error function to extract information from the error response.

When an operation method throws an exception, the agent library sends error information to the server, which in turn sends it back to the browser that invoked the operation. Your JavaScript code can extract fields from the error information.

Procedure

Code the error response to extract the message, details and status fields from the error, as needed.
function(data) {
  // Success response
  ...
  },
function(error) {
// Error response
  // Get the error message
  var errorMessage = error.message;
  // Get the error details
  var errorDetails = error.details;
  // Get the error status code 
  var errorStatusCode = error.status;

  // Use this information
  ...
  });
}