Skip to main content

Within my API, validation errors are returned with a HTTP error 400 and a message.

When I test the API as an action in Zapier and hit a validation error, zapier flags the zap as failed, emails me to tell me there is an issue but all I get is the first word of the error message as Zapier truncates the message

What happened (You are seeing this because you are an admin):Stack trace:  ResponseError: {"status":400,"headers":{"content-type":"application/json"},"content":"{\"success\":false,\"message\":\"An

How should I be returning validation errors from my API so that Zapier will handle them in a more friendly error. I can’t see any documentation that covers this.

If you’re working in the UI and reviewing the UI docs you might not have seen this section of the CLI docs which are equally applicable when you’re handing errors while developing in the UI.  https://zapier.github.io/zapier-platform/#error-handling

 

If that section doesn’t address your question, please share some code snippets around how you’re handling errors today and we can go from there to get you a better answer.


I did see that subsequent to writing the question so my error handling is improved but I still have doubts. 

If the data passed to my API is invalid it returns an error 400. I now catch that, extract the message and code and throw a Zapier error 400. 

Zapier still fails the action but this time it has a nice message.

Is that how validation errors should be handled? 

Is there a way to plugin to the Zapier validation that moans about missing data in the request?