Services.getErrors

The Errors is a server side JavaScript object that contains functions that allows the creation of customizable error handling functionality specifically returned from the server, for example a 404 HTTP Not Found error. The error handlers are created using a description string and an error code. The errors are as follows:

Further documentation.

JavaScript example:

 // call Users REST API
 function callUsersAPI()
 {
   var response = services.rest.get("http://example.com/rest/users");
   if(!response.isSuccess()) {
     switch(response.code) {
       case 401:
          // Send an email stating that the service is authorized
          fields.unauthorizedError.value = response.body;
          resources.sysAdmin.sendMail();
          throw services.errors.createAuthorisationError("Unauthorized", response.code);
       
       default:
          throw services.errors.createRequestError("Request error", response.code);
   }
   //process result
 }

 

returns Errors