Forum Discussion
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.
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