Introducing Throw Statements in Deluge

Introducing Throw Statements in Deluge

Hello everyone,

We're introducing a powerful addition to Deluge that gives you more precise control over error handling in your scripts.
Whether you're calling an external API, validating user input, or enforcing a business rule, there are moments when a script needs to stop and flag that something went wrong. Take API calls as an example: a script using invokeUrl gets marked as successful the moment the call is made, not when it actually succeeds. That means an API returning a 400, a rejected payload, or a silently failed transaction can all leave the script looking green while the business process behind it breaks.

Handling this today involves a lot of workarounds. It works, but it's tedious. That's why we're introducing the throw statement in Deluge.

What throw does

throw lets you explicitly raise a custom exception the moment something goes wrong, whether it's an API returning an error, a business rule being violated, or a validation check failing. The script stops right there and passes control to the nearest matching catch block.

throw and catch, working together
throw is designed to work hand-in-hand with catch. Think of it as a two-part flow:
  1. throw raises the exception with the details you define.
  2. catch picks up the exception and decides what to do with it, whether retrying, notifying someone, or handling it gracefully.

If no catch block is available to handle a thrown exception, the script terminates with the exception details, so a failure never gets silently swallowed. 

A quick example

Here's a simple use of throw. If the order quantity is zero or negative, the script raises an exception and the catch block handles it:
Quote
try
{
   if(orderQuantity <= 0)
   {
       throw "Invalid order quantity";
   }
   info "Order accepted.";
}
catch(e)
{
   info "Order failed: " + e;
   info "Line number: " + e.lineNo;
}

Now, let's consider a business scenario. Say you have a Deluge function that pushes a new invoice to an external accounting service:

Quote
invoicePayload = Map();
invoicePayload.put("invoice_id", "INV-1042");
invoicePayload.put("amount", 2500);
invoicePayload.put("currency", "USD");

try
{
   response = invokeUrl
   [
       url : "https://api.example.com/invoices"
       type : POST
       parameters : invoicePayload
   ];
   if(response.get("status") != "success")
   {
       throw {
           "message" : "Invoice sync failed",
           "data" : response
       };
   }
   info "Invoice synced successfully.";
}
catch(e)
{
   info "Sync failed: " + e.message;
   info "API response: " + e.data;
   info "Line number: " + e.lineNo;
}
Here, we've explicitly told throw to attach the API response as part of the exception. When the accounting service rejects the invoice, the script stops, and the calling catch block receives the full response for inspection (exactly the context needed to log, retry, or alert).

What else throw unlocks

A few things worth knowing once you start using throw:
Rich exception details
Along with a message, you can attach data of any Deluge type. This is what makes exceptions useful downstream. Some examples of what to pass:
  1. The API response, for API-related failures
  2. The record ID and current field values, for validation errors
  3. The user input that triggered the issue, for form-level checks
  4. Any custom object that helps the catch block understand what went wrong

Re-throwing exceptions
Sometimes one catch block isn't enough. Re-throwing lets you handle an exception at more than one level. You can nest try-catch blocks inside each other. An inner catch can do its own work with the exception, then pass the same exception up to an outer catch by throwing it again.
Sample code:

Quote
try
{
   try
   {
       // sync logic here
   }
   catch(e)
   {
       info "Sync failed: " + e.message;   // local logging
       throw e;                                    // re-throw to outer catch
   }
}
catch(e)
{
   // outer handler: notify the user, roll back, alert admin, etc.
}
The inner catch records the failure, and the outer catch handles the response like notifying or rolling back, without either duplicating the other's logic.

Exception propagation
If a function raises an exception without handling it, Deluge moves the exception up to the script that called the function, giving that script the chance to catch it. This is what makes reusable validation functions possible: you can write validation logic once, throw inside it freely, and let the calling script decide how to respond. 

Documentation

For detailed information, refer to the throw statement help page.

We believe the throw statement will be a great value addition to your Deluge scripts. Give it a try and let us know what you think.

If you have any questions or need assistance, feel free to reach out; we're always happy to help.

Regards,
The Zoho Creator Team

    Access your files securely from anywhere

        Zoho FSM Video Tutorials


              All-in-one knowledge management and training platform for your employees and customers.






                                    Zoho Developer Community




                                                          • Desk Community Learning Series


                                                          • Digest


                                                          • Functions


                                                          • Meetups


                                                          • Kbase


                                                          • Resources


                                                          • Glossary


                                                          • Desk Marketplace


                                                          • MVP Corner


                                                          • Word of the Day


                                                          • Ask the Experts



                                                                    • Sticky Posts

                                                                    • Zoho Creator + LLMs using Zoho MCP: Bring contextual AI into your apps

                                                                      Hello everyone, We're excited to share that Zoho Creator can now be integrated with leading AI models(like Claude) using Zoho MCP. As you know, Zoho Creator has been a pioneering low-code platform with a razor-sharp focus on making it easy to build business
                                                                    • Introducing Zoho Creator's 2025 Release Projection 2

                                                                      Hello Creators! I'm Prakash, from the Creator product management team, and today I'm delighted to unveil our next set of features as part of Release Projection 2 for 2025. With thoughtful analysis and planning, we've curated powerful new capabilities
                                                                    • Zoho Creator - 2023 Release Projection 1

                                                                      Hello everyone! A very Happy New Year to you and your family. Hope you're all good and having a great time using Zoho Creator to make your lives easier and your businesses prosper. 2022 was an action-packed year for us at Creator, and we hope to continue
                                                                    • Zoho Creator User Group meetups in a city near you! - Oct - Nov, 2023

                                                                      Greetings from the Zoho Creator team! We're hosting a series of Zoho Creator meetups in various cities across the globe, and we'd love to meet you there! Our meetups are a great opportunity to network with industry peers, exchange ideas and best practices,
                                                                    • Zoho Creator - 2023 Release Projection 2

                                                                      Hello everyone! Time truly flies when you're having an incredible journey, and today we mark the completion of an eventful and action-packed six months. It feels like just yesterday when we embarked on this adventure together with the launch of our new


                                                                    Manage your brands on social media



                                                                          Zoho TeamInbox Resources



                                                                              Zoho CRM Plus Resources

                                                                                Zoho Books Resources


                                                                                  Zoho Billing Resources

                                                                                    Zoho Projects Resources


                                                                                      Zoho Sprints Resources


                                                                                        Qntrl Resources


                                                                                          Zoho Creator Resources



                                                                                              Zoho CRM Resources

                                                                                              • CRM Community Learning Series

                                                                                                CRM Community Learning Series


                                                                                              • Kaizen

                                                                                                Kaizen

                                                                                              • Functions

                                                                                                Functions

                                                                                              • Meetups

                                                                                                Meetups

                                                                                              • Kbase

                                                                                                Kbase

                                                                                              • Resources

                                                                                                Resources

                                                                                              • Digest

                                                                                                Digest

                                                                                              • CRM Marketplace

                                                                                                CRM Marketplace

                                                                                              • MVP Corner

                                                                                                MVP Corner









                                                                                                  Design. Discuss. Deliver.

                                                                                                  Create visually engaging stories with Zoho Show.

                                                                                                  Get Started Now


                                                                                                    Zoho Show Resources

                                                                                                      Zoho Writer

                                                                                                      Get Started. Write Away!

                                                                                                      Writer is a powerful online word processor, designed for collaborative work.

                                                                                                        Zoho CRM コンテンツ


                                                                                                          Nederlandse Hulpbronnen


                                                                                                              ご検討中の方





                                                                                                                        • Recent Topics

                                                                                                                        • In ZOHO Books, it appears that there is a maximum of 200 Shipping addresses.

                                                                                                                          I am using ZOHO Books and what you call a shipping address, we use as a Service address. I have a couple of customers that have Many Many service addresses, I am starting to get an error saying too many shipping addresses. Additionally, is there a way
                                                                                                                        • How can I add a Custom Field (or Customer_name) to a picklist?

                                                                                                                          Our workflow is Shopify-->SO -->Picklist-->Package-->Shipment. We would like to have the Picklist template to include a custom field "Customer_Notes" (we have created this field already). This way we get alerted when a customer has notes on their account.
                                                                                                                        • Can't copy and paste from email in Zoho email client

                                                                                                                          I don't know what happened, but I have lost the ability to cut and paste information from an email.
                                                                                                                        • Which Zoho CRM tasks would you want an AI assistant to handle?

                                                                                                                          I’ve started delegating my Zoho CRM work to AI – and many tasks now take me half the time. It has been so useful that we’re now working to make it available to everyone. Instead of clicking through records and tabs, I simply describe what needs to be
                                                                                                                        • What's New in Zoho Inventory | July & August 2026

                                                                                                                          Hello users, The July and August 2026 releases bring a range of new features and improvements across the product. From the Nigeria Edition and Super Admin enhancements to Sri Lanka IRD-compliant invoicing, Loyalty Program Management, and improvements
                                                                                                                        • Hide Inactive Social Sign-In Providers from Login Screen

                                                                                                                          Hello Zoho Team, We hope you are doing well. Currently, Zoho One allows admins to configure security policies and enable or disable Social Sign-In options for third-party providers such as Apple, Google, Microsoft, LinkedIn, Yahoo, Twitter, Facebook,
                                                                                                                        • Forms data export bug

                                                                                                                          The export csv with a password has changed for the worst. It is less secure by not allowing complex passwords. Just last week and the last year (at least) I was able to use a complex, secure password. Export CSV moreover doesn't even work if I use a simple
                                                                                                                        • How does Zoho handle the daylight savings time change in Alberta?

                                                                                                                          Alberta has just made the decision to get rid of daylight savings. This means that as of November 1, 2026 we remain on UTC-6 year-round. We have timing errors in meetings scheduled after that For example, we scheduled meetings in late November at 9:00
                                                                                                                        • Zoho Projects - Linking CRM Deals to Projects via API without sending customer contact email invitation to project portal

                                                                                                                          We are using the Zoho CRM and Zoho Projects APIs to automatically create a project in Zoho Projects and then associate that project with the relevant Deal in Zoho CRM. The API process is working in that the project is created successfully and appears
                                                                                                                        • Need to set workflow or journey wait time (time delay) in minutes, not hours

                                                                                                                          Minimum wait time for both Campaigns workflows and Marketing Automation journeys is one hour. I need one or the other to be set to several minutes (fraction of the hour). I tried to solve this by entering a fraction but the wait time data type is an integer
                                                                                                                        • Shared Mailbox in iOS app

                                                                                                                          Hi, On the desktop I am using a Shared mailbox for our company's general mailbox that somebody else should be able to view. In the iOS app however I can't find it? Old sources on the internet says this isn't possible but that can't be right? Somebody
                                                                                                                        • Issues with Zoho Insights and email template web links

                                                                                                                          Is anyone else out there having the same issue we're experiencing? When we send out an email template, Zoho insights is converting the URLs from the URL we insert in to the template in to one of the form https://mailer1.zohoinsights.com/ocgeturl/2d6f.327230a?l=0ed7f050-5b31-11eb-a1a...
                                                                                                                        • UCP: Why We Killed the Multi-Portal Mess and Simplified Customer Self-Service

                                                                                                                          Let's talk about the multi-portal mess nobody wants to admit that it exists. Your customer needs an invoice from one app, wants a ticket update from another, and has a project waiting in a third, each behind its own login, its own UI, its own "was it
                                                                                                                        • Object-level edit permissions

                                                                                                                          Hi, we are currently running into a limitation with permissions inside larger workspaces. Our use case is a central Analytics workspace that contains many tables, Query Tables, reports and dashboards used by different teams. We would like to allow certain
                                                                                                                        • inventory removal at packing list or shipment.

                                                                                                                          currently our system is set to remove inventory at invoice. This is creating an inventory nightmare? Is it possible to change the settings to remove the item from inventory at either the packing slip stage or shipping the item.
                                                                                                                        • Item description is not displayed

                                                                                                                          I added the item description while importing the new item through the bulk item Excel sheet, and the import was completed successfully. However, I cannot see the description in the item details under Inventory. Could anyone please advise how to make the
                                                                                                                        • Shared inbox unable to see replies

                                                                                                                          Hi we are a small company me and someone else, we have a shared inbox for our sale@ and contact@ however we have this issue where by if i reply to an email or the other person reply to the email, it does not show it to them and therefore we end up replying
                                                                                                                        • Record Payment - Auto Populate Amount as payments are selected

                                                                                                                          When recording payments you have the option of clicking on "Pay in Full" next to the bill which automatically adds the total at the bottom of the page next to "Amount used for payments" but this should also auto populate / update the total at the top
                                                                                                                        • Can't set conditional layout rule on lookup field in Zoho CRM

                                                                                                                          Namaskaram Zoho CRM team, Usually any fields of module except mandatory fields can be hide using conditional layout rules. But that can't be set on lookup fields event that is not a mandatory fields. Many users are in need of that. Crafted with ❤️ Zoho
                                                                                                                        • [Request] Pivot filter date option : from set date to relative value ie from 01Jan to LastMonth

                                                                                                                          I don't think I can currently do this... but it's worth asking if it's possible. My use case is concerning annual leave which is calculated from the beginning of the calendar year (01Jan) then each month I want to have details of leave taken etc... In
                                                                                                                        • Need to be able to apply layout rules to 'Multi Pick List'

                                                                                                                          Currently, we are unable to apply layout rules to fields that are 'Multi Pick List'. This means we have to instead use checkbox fields, but they are inefficient. For example, we use the Multi Pick List to list our products. However, we're unable to apply
                                                                                                                        • Announcing the new SKILL.md for Zoho CRM and the updated OAS repository!

                                                                                                                          We are introducing a new zoho-crm skill to make working with Zoho CRM Developer tools (like APIs, functions, widgets, client scripts, queries etc) easier and faster, with the help of AI in your preferred AI harness like Claude Code, Codex, Cursor, VSCode
                                                                                                                        • My "trigger" panel disappear from my workflow ...

                                                                                                                          Hello, I want to add a trigger to an email sequence, but the "trigger" panel has disappeared when I want to modify ...I used a predefined template to create this sequence, is that because of that? Thank you. I have attached a screenshot to you
                                                                                                                        • Workflow Automation Not Triggering

                                                                                                                          My Zoho CRM workflow sometimes doesn’t trigger when a record is updated, even though the workflow criteria appear to be met. What should I check to find out why the workflow is being skipped?
                                                                                                                        • AI Calling

                                                                                                                          Hi, does anyone have experience or any thoughts on AI Calling. Getting AI to make calls on behalf of your company. We are looking into it, but are finding it difficult to get info and providers that can assist.
                                                                                                                        • Zoho Sheet as KB Document

                                                                                                                          It would be nice if Zia Agents could take Zoho Sheets as part of the knowledge base. The use case here is that it's infinitely easier for humans to maintain a spreadsheet table than any .md / TAML / JSON document. For situations where humans are responsible
                                                                                                                        • Ask the Experts: Five-hour live Q&A session with Zoho WorkDrive product experts

                                                                                                                          Have questions about WorkDrive 5.0? Let’s talk! We recently launched Zoho WorkDrive 5.0, packed with powerful updates to help your team work smarter, stay secure, and get more value from your business content. From content-centric workflows and AI-powered
                                                                                                                        • Automating CRM backup storage?

                                                                                                                          Hi there, We've recently set up automatic backups for our Zoho CRM account. We were hoping that the backup functionality would not require any manual work on our end, but it seems that we are always required to download the backups ourselves, store them,
                                                                                                                        • Zoho Community Digest - September 2026 | Part 3

                                                                                                                          Hi everyone, and welcome back! Zoho CRM launches PRM for partner management, Bigin builds this year's Apple AI updates into the app, and Snapchat is now a connected channel in Zoho Social. There are also three notices worth reading, including WhatsApp
                                                                                                                        • Change from OST to PST on Windows 10/11 Using Free Method

                                                                                                                          There is an advantage in converting OST files to PST format if you need to access your Outlook data on a different computer, want to keep a local copy, or are trying to recover items from an old Outlook profile. The good point is that users of Windows
                                                                                                                        • ERROR: This user is not allowed to add in Zoho. Please contact support-as@zohocorp.com for further details

                                                                                                                          I can add new user for mail, i received message error about; This user is not allowed to add in Zoho. Please contact support-as@zohocorp.com for further details Try creating user name; instagram@eficaztecnologia.com.br
                                                                                                                        • Support for Custom Fonts in Zoho Recruit Career Site and Candidate Portal

                                                                                                                          Dear Zoho Recruit Team, I hope you're doing well. We would like to request the ability to use custom fonts in the Zoho Recruit Career Site and Candidate Portal. Currently only the default fonts (Roboto, Lato, and Montserrat) are available. While these
                                                                                                                        • Ability to filter services and parts based on a field in the Work Order

                                                                                                                          Hell FSM team, We have a customer with 2 value streams using Zoho FSM. Each value stream uses different products, at different price point. Currently, all of the products are accessible when creating a work order and modifying a service appointment, which
                                                                                                                        • SubTotaks for Item Headers in Estimates

                                                                                                                          Hi, Apparently, one can add Item Headers in Estimates in Zoho Books. Is this feature like an Estimate section with a SubTotals for each Item Header/Section? Or is the Item Header just a Title and cannot be SubTotalized? Thank You
                                                                                                                        • Sync of products and orders between Zoho Inventory, Zoho Books and Shopify

                                                                                                                          Good Day I migrated from QuickBooks to Zoho Books and Zoho Inventory at the beginning of this year. The migration team assisted with importing my data, but I am currently experiencing multiple issues affecting syncing between Shopify and Zoho. 1. SKU
                                                                                                                        • Best practices for importing phone numbers

                                                                                                                          I've recently found a problem with my phone provider, integrated with Zoho CRM, where a phone number that starts with 00 instead of + won't work. The problem has no solution: they tell me to replace all 00 with + I've always preferred using 00 instead
                                                                                                                        • Copy + Paste in Notes: Text color and text background are not retained

                                                                                                                          I've recently started using Zoho Notebook as an Evernote replacement. When copying and pasting text within Zoho Notes, I notice that the formatting of the text (text color and background color) is not retained when pasting. Only the attributes "Bold"
                                                                                                                        • Add Comprehensive Accessibility Features to Zoho Writer

                                                                                                                          Hello Zoho Writer Team, We hope you are doing well. We would like to submit a feature request to enhance Zoho Writer with a full set of accessibility tools, similar to the accessibility options already available in the Zoho Desk agent interface. 🚧 Current
                                                                                                                        • MAKING ENTRY TIME MORE USER FRIENDLY AND FASTER O PREVENT TAB TIME

                                                                                                                          I AM CURIOUS TO KNOW IF WE CAN MAKE IT MORE USER FRIENDLY WHILE MAKING BILLS , I MAJORLY USE OVER DESKTOP SO I AM SUGGESTING TO REMOVE TAB TIME WHILE ENTERING BILL OR MAKING INVOICE DIRECT JUMP TO ONLY REGULAR PARTS OF THE BILL . YOURS RAKESH 782866
                                                                                                                        • Email Forwarding to Zoho Desk Failing After Migration from Gmail to Outlook (Microsoft)

                                                                                                                          We recently migrated from Gmail to Microsoft Outlook. Since the migration date, emails sent by our customers are no longer being received by Zoho Desk. I tried setting up the email forwarding rules in Outlook similar to what we had in Gmail, but it still
                                                                                                                        • Next Page