SnapLogic Errors: Return custom payload and fail pipeline

Is it possible within SnapLogic to configure a pipeline to fail via a Snap but also to return a custom output back to the user (configured via a Mapper snap, e.g.)

I have reviewed the video here: Framework: Error Handling & Retry Patterns and it appears that a SnapLogic pipeline can either:

  • fail with limited control on the error message (e.g. using the Exit snap which allows for a text message) OR
  • specify a detailed error message (e.g. via an error pipeline or directly)… in this case the pipeline is marked completed.

@omair, This may not be your exact use case, but here is a high-level view of how I do something similar to this:

  • On an error view, add the custom message mapper and notification snap just prior to the exit snap.
  • Then join the non-error output view to the exit output view with a union+sort to ensure processing doesn’t continue before the exit has time to process (you can eliminate this piece if you don’t care if valid records are processed before an error exit is triggered).
  • If the exit isn’t triggered, then the pipeline will continue.

(Edit) - The above works with email notifications - which is what I first read into your question - possibly incorrectly. However, if you’re looking for API type output to the user, this example will not work.

Thanks @del … but, yeah…

I was looking for API-type output to the user…

hey omair,

Have you tried the Exit snap? It allows you to set an error message that can be returned to the user.

If you call that via a triggered task, then you’ll get this kind of response.

      "failure" : "Pipeline execution failed while waiting for output",
      "reason" : "Snap errors: {ruuid=52e99318640a9a03d8681d0d_9b3dd03a-dde2-43e8-a0ba-fd58239c2a5d, reason=Number of input documents received is more than 0, label=Exit, resolution=Try passing less than or equal to 0 input documents, failure=Beep Boop! Failure!}",
      "resolution" : "Fix the reported errors"

You’d still have to extract it from the reason String, so not the most user friendly way.

You could also do something like this:

Where the mapper returns the output before the exit snap is invoked using a sleep in a Script snap. This will return a response like

        "error": "Beep Boop! Failure!"

Which is easier to deal with.

This isn’t the most elegant approach since there is a race condition between when the mapper’s output is written out and when the exit snap processes the document from its input stream.

Are you referring to a custom binary header, so you could manipulate the response? If that’s the case, you can use Mapper to map the status and the message, than add a JSON Formatter snap, and add the incoming status and message in a binary header properties.

Understanding Synchronous and Asynchronous Execution of Triggered Tasks

Hope this helps,


Bojan Velevski