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

                                                                                                                            • Mailchimp Integration

                                                                                                                              Hello, I am needing some help. Does anybody have a recommended source for information on the Zoho-Mailchimp integration. We are working on a system to import large amounts of records into Zoho that will sync into Mailchimp for us to run a mail campaign out of. Let me explain what the process we are trying to implement - any information or advice is appreciated. Import record data base into Zoho Leads module --> use Lead source to ID records that are part of this mail campaign Zoho Leads (specific
                                                                                                                            • [Free webinar] Zoho Creator meets AI with MCP | Creator Tech Connect (November 2026)

                                                                                                                              Hello everyone, We are excited to invite you to another edition of the Creator Tech Connect webinar. About Creator Tech Connect The Creator Tech Connect series is a free monthly webinar consisting of purely technical sessions, where we dive deep into
                                                                                                                            • Invalid Client - Client ID passed does not exist

                                                                                                                              I tried connecting the Zoho campaign with the "Uncanny Automator". It shows an error " Invalid Client - Client ID passed does not exist". There is no option to add manual API. URL: https://accounts.zoho.eu/oauth/v2/auth?response_type=code&client_id=1000.MSFIUOA1G8YBK7IFRL9Z0NINM6DW9C&scope=ZohoCampaigns.contact.ALL&redirect_uri=https%3A%2F%2Fapi.automatorplugin.com%2Fv2%2Fzoho-campaigns&prompt=consent&access_type=offline
                                                                                                                            • Field of Lookup - 5 Field Association Limit.

                                                                                                                              This query relates to the post at: https://help.zoho.com/portal/en/community/topic/introducing-the-field-of-lookup-in-crm-public-early-access-2023 My simple (and common) scenario: I select an account / customer lookup and want their address pulled into
                                                                                                                            • Task status - completed - other options

                                                                                                                              I have a dumb question I know i can make custom statuses for the tasks - but is there anyway to make additional "completed" statuses like for instance if i have a task "call back customer" and i leave a vm for them to call back marking it "completed -
                                                                                                                            • #20 I've Sent It and It's Wrong

                                                                                                                              Meera spots a mistake in an invoice just four minutes after sending it. She has billed a photoshoot at the half-day rate instead of the full-day rate. Her first thought is to delete the invoice and start again. But is deleting the right thing to do? It
                                                                                                                            • Zoho Forms API

                                                                                                                              Is there any way to get all form entry list using API? Looking forward to hear from you
                                                                                                                            • BNZ Bank Feeds No Longer Available

                                                                                                                              The BNZ (New Zealand) bank feeds are still failing and it's been months since they last worked! Uploading bank statements (CSV's) mean waiting to the end of the month when they become available. It is unacceptable to keep my clients waiting for payment
                                                                                                                            • MCP is now easier to access and configure in Bigin

                                                                                                                              Greetings! We hope you're all doing well. We've previously introduced Zoho MCP for Bigin, which lets you connect Bigin with AI tools and interact with your Bigin data using natural language. Now we're making MCP easier to access and configure directly
                                                                                                                            • Launch agents from more custom button locations and attach files in Ask Zia

                                                                                                                              Hello all, Your agents now meet your team where the work happens. You can add agents to custom buttons in list views, create and edit pages, and related lists, so users launch them without leaving the page they’re on. What’s new Agents in more custom
                                                                                                                            • Phone system to integrate with Zoho CRM

                                                                                                                              I am looking for phone software that would allow my agency to do the following within Zoho CRM: Make calls from zoho Track calls and notes Leave pre-recorded messages after reaching voicemail of lead Only 2 members, so need company who will allow just
                                                                                                                            • Introducing PRM: Build, manage, and scale your partner ecosystem

                                                                                                                              Growing a partner ecosystem is a good problem to have. What starts as a handful of partners can quickly turn into a maze of spreadsheets, emails, and disconnected processes. More partners mean more opportunities, greater reach, and new ways to grow
                                                                                                                            • Zoho Projects connector with Zoho CRM (Related List module) features

                                                                                                                              Hi community, I use Zoho Projects connected to Zoho CRM, where we associate Projects with Deals, clients, etc.. I am looking to change/edit the fields that are available in the integration. Currently it shows Project Status, Project Completion, Milestones,
                                                                                                                            • Feature Request: Render Markdown (.md) files in Zoho Cliq

                                                                                                                              Hi, We regularly share Markdown (.md) files in Zoho Cliq. However, when we open these files in Cliq, the content does not render as Markdown—it displays as plain text. This forces us to copy/paste the content into an external Markdown viewer to read it
                                                                                                                            • Free webinar: Zoho Sign for Microsoft apps

                                                                                                                              Hello, Did you know Zoho Sign works right inside the Microsoft apps you already use? A signature request shouldn't mean leaving Teams for another tab, or downloading an Outlook attachment just to sign it. Zoho Sign integrates with Microsoft 365, Teams,
                                                                                                                            • Users can now notify the contact while adding a 'Resolution' to the ticket.

                                                                                                                              Hello, In the latest version of the Desk iOS mobile app (v2.6.4), users can now notify the contact while adding a 'Resolution' to the ticket. Also, the 'Resolution' UI has been tweaked to support edit and delete option.   Please update the app either
                                                                                                                            • Better Time Tracking

                                                                                                                              We need better time tracking customization for IT MSPs. We also need reporting that is built in, rather than having to try and fumble with creating custom reports. We also need to be able to mark whether a ticket has been billed or not, I don't think
                                                                                                                            • Introducing Custom Fonts for Career Sites

                                                                                                                              Your Careers page is often the first place candidates interact with your organization. From exploring job opportunities to submitting applications, a consistent visual experience helps candidates recognize and connect with your brand. To give you more
                                                                                                                            • Need help with importing expenses

                                                                                                                              I'm using the template downloaded from the application. When I try to import my expenses, I get the message: Duplicate entry in the Expense Date column. Ensure it contains unique values. None of the rows will import. There are duplicate dates, but they
                                                                                                                            • time tracking on zoho crm cases

                                                                                                                              Is there a time tracking feature in zoho crm cases? I need calculate time spent in calls, tasks and events Thanks in Advance  
                                                                                                                            • Integrate with Power BI

                                                                                                                              Hi, How to connect Zoho CRM dashboards & reports with POWER BI ?
                                                                                                                            • Unbundle feature for composite items

                                                                                                                              We receive composite items from our vendors and sell them either individually or create other composite items out of them. So, there is a lot of bundling and unbundling involved with our composite items. Previously, this feature was supported in form
                                                                                                                            • Zoho Recruit: Time to Step Up Your AI Game!

                                                                                                                              I've been using Zoho Recruit for many years and I love it. But let's be honest, it's starting to feel a bit like a relic from the pre-ai era. I recently tried out new systems that have ai resume screening and ai interviewing capabilities, these systems
                                                                                                                            • Zoho mail app throwing network error

                                                                                                                              Zoho mail app is throwing network error and I do not know how to fix the issue.
                                                                                                                            • Cannot unblock account

                                                                                                                              Hi, I have recently been travelling for work and now my mail account has been locked due to suspicious activity (I guess login attempts from different countries) however when I go into my admin panel it won’t let me unblock and asks me to contact support.
                                                                                                                            • Time logging issues

                                                                                                                              I am losing times tracked on tasks. The problem is that it is not clear when the time is logged, when the timer is stopped or when the task is closed? I've done both and neither works. Whats more when the task is closed, the tracked time disapperas (i guess bc it shouldve been logged) but when it's not logged you've just lost your tracked time.  The bigger problem is the UN-NATURAL way this time logging is set up. On every other plat form that tracks time, it is made clear to save timer or log when
                                                                                                                            • Start/Stop Timmer in Chrome Extension

                                                                                                                              The chrome extension is great and allows you to do allot however one of the most common things employees working on projects need to do is track their time. Having an easy start/stop timer to track time would be great.
                                                                                                                            • Employee Logged Hours Report

                                                                                                                              Hi Team, We are looking at having all Employees logged hours report, but different staff uses diferent modules to log their time. Is there anywhere that we can get a report that captures every time entered through all Zoho modules? Thank you.
                                                                                                                            • Time Log Report Across Zoho Apps?

                                                                                                                              Currently there are at least 4 different apps in Zoho where users can book time. Projects Desk Books People In our case for instance, the same user may book time against both Projects and Desk Tickets. So we have no way to see a simple timesheet for a
                                                                                                                            • Zoho Time tracking option with automated screen shots.

                                                                                                                              Time tracking option with automated screen shots would be an exceptionally good feature, any plans to develop something like that? Please do the needful. Thank you, Raj Rajinc
                                                                                                                            • Detailed time tracking (for productivity/accountability). How to?

                                                                                                                              Hello everyone! I read an interesting article about accurately tracking your time in 15 mins intervals and after some time analyzing it in order to improve your productivity. I'd like to give this a try myself. I would like to use Zoho apps. (How) could I do this? Thanks for the tips!
                                                                                                                            • Time Tracking Needed in Zoho

                                                                                                                              It seems lots of people request a Time Tracking Zoho Desktop App, that is only problem I have with working with Zoho. People need to know how much time they spend on specific tasks. Is Zoho planning to do this sometime in the future?
                                                                                                                            • emails?

                                                                                                                              Why can't I send emails from my account anymore
                                                                                                                            • Backorder For Composite Items

                                                                                                                              Hello If i released SO for composite item and use backorder feature of zoho inventory then it should backorder child item items of composite and not composite item.This is basic of backordering.I conveyed this to zoho call center but no solution yet.
                                                                                                                            • Global Constants / Variables

                                                                                                                              It would be great if there were a Global Constant feature. The idea here is for managing constants that are used in multiple Flows and Subflows, but might change over time. The idea is that the change could be made in one place and cascade to all future
                                                                                                                            • Deal Activity Tracking - By Time

                                                                                                                              Hello, I am trying to figure out a way to implement a time tracking ability within the CRP that will provide a line item on the final invoice in books. Would the Cases module be of good to use in this scenario? Want to integrate into Books as well. I
                                                                                                                            • Time Card Tracking For Employees

                                                                                                                              Does ZOHO have an add-on or app that my employees can use to clock in & out on a daily basis. In the past we had used a third party solution, but it was hard to use and pricey. We would really like to use your time tracking feature if you have one......if
                                                                                                                            • Logging time within Time Tracking

                                                                                                                              At the moment I use the call logging feature of CRM to log time spent on clients work. Its nice to be able to start, stop and pause the timer and record how many hours I need to bill the client. Any chance of implementing this in Zoho Invoice's time tracking feature The same interface as CRM would be great or a simple start/stop/pause/restart timer.
                                                                                                                            • 3rd Party/Easy Time Tracking Integration with Zoho

                                                                                                                              We are new customers using Zoho One with Zoho Project/CRM/Desk being the 3 big applications we will use. The majority of our work is done in the field and we need accurate and easy time tracking for our workers on mobile phones. aka TSheets type functionality. but tied to Zoho. Zoho is outstanding overall so I am surprised at how laborious, inefficient and disconnected time tracking is mobile devices. Adding time to a project task on a mobile phone can be a 10+ click task and that's not an exaggeration!
                                                                                                                            • TrueSync for Windows 5.16+ breaks Excel save in "Shared with Me" (temp file writes fail) – workaround: pin 5.15.1

                                                                                                                              Hi all, After TrueSync for Windows auto-updated past 5.15.1, some of our users can no longer save Excel files that live under "Shared with Me". We isolated it to a client-side regression and found a workaround. Sharing in case it saves someone a few hours
                                                                                                                            • Next Page