Handling Approval Errors

You should always check that any approval API call was successful before using the results.

This is a two-step process:

The following example checks for errors when using the NSOA.wsapi.approve(approveRequest) function:

          // example assuming requests have already been defined
var results = NSOA.wsapi.approve(requests);
// Check for errors
if (!result || !result[0]) {
     // An unexpected error has occurred!
} else if (result[0].errors !== null && result[0].errors.length > 0) {
     // There are errors to handle!
} else {
     // Process the response as expected
} 

        

The errors property is an array of oaError objects.

See Code Samples for more examples.