With ONEiO, you can handle response errors with response rules. This is handy because we can send a response back to the inbound endpoint when an outbound error is created.
Here are some examples of cases where we could receive an error:
- An attachment not being processed due to its size, and we create a response/comment/etc back the inbound endpoint of this error to inform them of this.
- Authentication issues.
- Permission issues, etc.
To handle response errors, we can create a response and in the operations, use the configuration: Response must be Error message. Then, we should set an attribute condition to filter this rule just for this case. We can do it by two ways:
- Handling the response body - if the response body contains a certain value, we process the rule.
- Handling the http response error (ex. 401, 413, etc). In some cases there is no response body, so we can point directly to the http response error. It could contains only the code or code and text.
In this case, the condition is sf:errors CONTAINS XXX, where XXX is the error code / text and code as seen in the screenshot below:
In this test example, the error is regarding an incorrect password (ONEiO -> JIRA) and the error code 401 was added to the endpoint's unrecoverable HTTP error codes so that it fails immediately rather then multiple tries. Be advised the unrecoverable HTTP error codes configured in the endpoint depend on the type of endpoint, use cases and how the API of the endpoint functions.
The following example is an error response message that is sent from the outbound endpoint(In this case, a JIRA endpoint).
We create a basic error response rule to have this message to be routed to the back to the inbound endpoint. In this example the only condition is that Response must be Error message. You can add more conditions to route a message for based different errors and others specific cases.
ERROR RESPONSE ROUTING RULE - The error message that is routed back to the comments of the incident in ServiceNow which was the original Inbound endpoint.
There are cases where there are multiple error messages or there is a need to extract specific message using regex. Check this article on how you could do so : Useful Regex search strings.