03-10-2021 09:07 AM
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:
03-10-2021 10:27 AM
@omair, This may not be your exact use case, but here is a high-level view of how I do something similar to this:
(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.
03-16-2021 01:53 PM
Thanks @del … but, yeah…
I was looking for API-type output to the user…
03-17-2021 08:32 AM
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.
11-01-2022 06:35 AM
Hi Tlikarish,
I would like to make the pipe line status as failed instead of completed.
My rest API sends the status as ok where few record inserted and few failed. I am counting if failed records >0 , then I am logging those record in log then exiting with exit snap. But the pipeline status is not failing. It shows completed. I want the pipe line status should show as failed.
Regards
Gyanendra