02-16-2022 02:17 AM
There is a requirement for the following:
Error pipeline for an ultra pipeline which responses with custom HTTP code, e.g. 500.
Why:
…The third party API caller shall receive a proper HTTP code, not only HTTP 200 with error message.
…Or when the pipeline goes into an error it will receive 504 gateway timeout, just because, on standard snaplogic i unable to catch the errors.
So:
…I have implemented the ultra pipeline(A) and implemented error pipeline(B).
…In the ultra(A) i have configured the error pipeline(B), so all the snaps use that error pipeline.
…In the error pipeline(B), depending on the error, i have implemented custom error codes using Mapper Snap (Document → Binary), see pic below.
BUT, when I save the pipeline(A) and the engine tries to initialize the ultra pipeline, i get the message from the engine:
Error pipeline does not meet the requirements
Reason: An unlinked output must be available when an error pipeline is used with an Ultra pipeline
Resolution: Please redesign the error pipeline to have a single unlinked document output view
Any ideas?
Solved! Go to Solution.
02-18-2022 07:13 AM
Hi @Szymon,
I created a sample ultra pipeline with an error pipeline and you actually can’t have an open binary output view on the error pipeline, it has to be document output view. However, you can still manipulate the status code for the error message.
This is a simple error pipeline that outputs the error message if there are any errors from the main pipeline.
If you call this API and if the pipeline has an error, for example you’ll receive the following response based on the configuration of the mapper snap in the error pipeline:
You can notice that the status in the response corresponds to the status in the Mapper snap.
02-16-2022 02:26 AM
Hi @Szymon,
- is it not possible to have a binary output in ultra? YES or NO
Yes, the ultra pipeline should have at least one open output view and one input view. If you use an error pipeline with the ultra pipeline, the error pipeline must have an open output view.
- what is the alternative to output custom error codes from error pipeline, so the calling party sees, not HTTP 200, but HTTP 500? I DO NOT WANT to use Error View at the particular snaps in Ultra pipeline!
To output a custom status code, you can pass the $status
header to the output snap ( for example JSON Formatter in the Binary header properties ) with your desired value. You can also do the same in a Mapper snap with binary output view if you want custom status code.
02-16-2022 02:34 AM
Thank you,
I am sorry, I was not making it 2000% clear, so updated the initial post for that.
ad 1. Now, the error, that I get is referring to the error pipline, that is used in ultra.
So, is it not possible to use binary output view in the error pipeline?
ad2. The goal is not to output custom http codes from the ultra pipeline itself, BUT from the error pipeline. When in error pipeline I do - as you suggest - convert document to binary using $status and $content, the error mentioned occurs, as soon as engine initializes the ultra pipeline.
02-16-2022 02:41 AM
Yes it is possible, however, if you are trying that with the Document to Binary snap make sure the data on the input has the $content
field otherwise that snap will fail because it requires the content field. You can also output custom message from the error pipeline, you can do something like this:
02-16-2022 04:33 AM
Thanks again.
However, the answer does not refer to the question.
I have edited the initial post again with more information.