Error Handling

If the returns flow fails to execute, a generic error message is displayed in the step header and the user will remain on the current step.

The generic message can be overridden in config via lang.returnsGenericError.

The flow can also return an error object at any point with a custom message:

Error response:

{
  "type": "error",
  "message": "Failed to submit return"
}

Given that the returns is a step process, if there's an error for example on the product_selection step, then the error object should be returned under the return_options branch (or whatever the next step_type is). In this case, the user will remain on the product_selection step with an error message displayed in the header.