sidebar.
In a rare situation, you might need to extract the information from the error retry data for further research. Assuming you are working with a custom flow, one way to automate the process is to write a postSubmit hook to send the payload info to a listener in a real-time flow.
Consider the following example:
The following sample code sends the response data to an integrator.io listener (webhook) for further processing, only when the response is not successful:
/* * postSubmitFunction stub: * * The name of the function can be changed to anything you like. * * The function will be passed one ‘options’ argument that has the following fields: * 'preMapData' - an array of records representing the page of data before it was mapped. * A record can be an object {} or array [] depending on the data source. * 'postMapData' - an array of records representing the page of data after it was mapped. * A record can be an object {} or array [] depending on the data source. * 'responseData' - an array of responses for the page of data that was submitted to the * import application. An individual response will have the following * fields: * 'statusCode' - 200 is a success. 422 is a data error. 403 means the connection went * offline. * 'errors' - [{code: '', message: '', source: ‘’}] * 'ignored' - true if the record was filtered/skipped, false otherwise. * 'id' - the id from the import application response. * '_json' - the complete response data from the import application. * 'dataURI' - if possible, a URI for the data in the import application (populated * only for errored records). * '_importId' - the _importId currently running. * '_connectionId' - the _connectionId currently running. * '_flowId' - the _flowId currently running. * '_integrationId' - the _integrationId currently running. * 'settings' - all custom settings in scope for the import currently running. * * The function needs to return the responseData array provided by options.responseData. * The length of the responseData array MUST remain unchanged. Elements within the * responseData array can be modified to enhance error messages, modify the complete * _json response data, etc. * Throwing an exception will fail the entire page of records. */ import { exports } from 'integrator-api' function postSubmit (options) { // Response data contains error if (options.responseData.statusCode != '200') { /* Send data to a listener */ exports.run({_id: '••••••••••••••••', listenerData: options.responseData}) } return options.responseData }
It is important to note that the response data will not contain an error ID that you can use to manage the error automatically when attempting to retry or resolve the error.
Comments
Please sign in to leave a comment.