Catch error and proceed with other transformer

There are times that I need to proceed with a flow even though an http transformer fails. With this, i have some questions.

  • How do i continue a task even though a transformer failed?
    Use case is when i fetch a product, and it doesnt exist, it will throw an error. After this, I need to post a product since it doesnt exist. But the current flow just stops everything from the error point.

  • The other one is how to mock an error? Use case is when I submit a PUT request, it will return 200, but returns relevant data with message : Invalid. How do I make the request fail so it notifies as failure?

Hi @brethren,

I will try to answer your questions.

  • You can use a conditional transformer to run another transformer if the product doesn’t exist. But does the response have a 4xx http code?

  • If the response was 200, you can mark the task as “skipped” and catch the message. In general you can’t mark the task as failed if the HTTP Response is 200.

Hi. @r.candrian

  • the problem here, is that the api is an error as mentioned in my initial post. so it stops. i want to catch this 400 error so i can proceed with the next transformer.

  • how can I check and mark a task as skipped? is this a setting in the routes?

I also need this functionality. There are times when I’m hitting an external service that aren’t critical to my route but I don’t want causing the route to error if it doesn’t succeed. @r.candrian, any word on whether this is possible or is being worked on?

Hi @brethren and @mark.nutter,

You can try to uncheck the “Abort process on errors” option in the HTTP client. This way, the process will not stop when receiving non-2xx HTTP responses.

Another options, You can also keep the option checked, but you will need to adjust the range of the HTTP response codes that should abort the running process.

You can follow this topic for this case:

If want to fail the process, you can try to use Error transformer.