apizapierzapier-cli

How Do I Create a Custom Error Response in Zapier


I am creating a new App for our customers to use. However, I am having a hard time finding any documentation on properly responding with error codes back to Zapier in the event something goes wrong.

One example I have, is a new customer creates a Zap and when attempting to look up data from our API, we have no data to return to them just yet.

It took me a while, but using the 400 HTTP header got me a little closer. But in this example, you can see, I just get a basic text response back. I know I'm logged in as Admin, so it will look different. However, without a doubt, I'm sure I need to format the response Object, so Zapier can lay out my error text like the second example.

Current Error

I am hoping to replicate what Google Sheets has done below and specify the response, so the user knows what the issue is.

Google Sheets Example Error


Solution

  • you can do something like:

      if (resp.status != 200) {
        throw new z.errors.Error(`Something went wrong.`);
      }
    

    You can read further here