Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Contact Us
  • Home
  • Built-in tools
  • Functions
  • Create a function

Error handling in Zapier Functions

Written by Owner

Updated at August 20th, 2025

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Tables
    Work with tables Manage tables Create tables Troubleshoot Zapier Tables
  • Product updates
    Product updates: January 2023 Product updates: March 2023 Product updates: February 2023 Product updates: April 2023 Product updates: May 2023 Product updates: June 2023 Product updates: July 2023 Product updates: August 2023 Product updates: September 2023 Product updates: October 2023 Product updates: November 2023 Product updates: December 2023 Product updates: January 2024 Product updates: February 2024 Product updates: March 2024 Product updates: April 2024 Product updates: May 2024 Product updates: June 2024 Product updates: July 2024 Product updates: August 2024 Product updates: September 2024 Product updates: October 2024 Product updates: November 2024 Product updates: December 2024 Product updates: January 2025 Product updates: February 2025 Product updates: March 2025 Product updates: April 2025 Product updates: May 2025 Product updates: June 2025 Product updates: July 2025 Product updates: August 2025
  • Zaps
    Zap basics Zap history Troubleshoot Zaps Manage your Zaps Do more with Zaps
  • Your Zapier account
    Plans Billing Account profile Notifications Data privacy & security Get help User roles and permissions
  • Interfaces
    Troubleshoot Zapier Interfaces Create an interface Use interface components Manage interfaces
  • Canvas
    Create a canvas Collaborate on a canvas
  • Chatbots
    Add logic and knowledge to chatbots Troubleshoot chatbots Create chatbots Manage chatbots
  • Getting started
    Intro to Zapier Set up your Zapier account Use case templates
  • Agents
    Create agents Manage agents Troubleshoot agents
  • MCP
    Set up MCP
  • Built-in tools
    Filter & Paths Formatter Schedule & Delay Email, IMAP, SMTP, & Email Parser Webhooks & Code Storage, Digest, & RSS Sub-Zap & Looping Other built-in tools Custom Actions & API Requests Functions AI by Zapier & AI actions Copilot Human in the Loop
  • Lead Router
    Create routers
  • Apps
    Connect and manage your app connections AI apps on Zapier Apps on Zapier
+ More

Table of Contents

Error classes Implement error handling Provide feedback and get help

You can handle errors from apps and from Python in Zapier Functions by using try except blocks and two classes: Exception and ZapierActionError.

miscBoltAlt icon Beta

This product is in open beta. It’s available for use but still in active development and may change.

Error classes

There are two classes you can use to handle errors in Zapier Functions:

  • Exception: a broad class that catches all errors, including Python errors.
  • ZapierActionError: this class catches only errors for Zapier actions included in your code.

You can use them while writing your code to take different actions depending on the type of error.

Implement error handling

To handle errors in Zap actions:

  1. From the Functions home, select the function.
  2. Click the Explorer icon on the left to see all function files. 
  3. Open the main.py file.
  4. Enclose the action code within the try block.
  5. Write an exception block right after, providing alternative instructions for errors. You can add multiple except blocks, and also use else and finally blocks.
try:
 zapier.action.slack.direct_message(
   account_id=50715278,
   params={     
     "channel":"ABCDEFG",  # To Username
     "text":"this is a direct message",  # Message Text
   },
   type_of="write",
 )
except ZapierActionError as e:
 zapier.action.slack.direct_message(
   account_id=50715278,
   params={     
     "channel":"HIJKLMN",  # To Username
     "text":"Your action had an error!",  # Message Text
   },
   type_of="write",
 )
ratingStar icon Tip

Check the logs for error messages and use the messages in if conditions to take different actions depending on the error.

Provide feedback and get help

Submit a feature request, provide feedback on existing features, or get help from the Zapier Functions team. You can also discuss Functions with other users on Zapier's Early Access Program Slack.

Was this article helpful?

Yes
No
Give feedback about this article

Related Articles

  • Create a workflow using Python with Functions
  • Create trigger events for your functions
  • Write code in Zapier Functions
  • Import packages in Zapier Functions
  • Use secrets in Zapier Functions

Copyright 2025 – OBZ-Zapier.

Knowledge Base Software powered by Helpjuice

Expand