Throw

Status: PLANNED - see the Workaround - Using JSON Module  || Workaround - Using HTTP Module section below.

In some cases, you may want to forcibly stop the scenario execution followed by the rollback or commit phase or to stop the processing of a route and optionally store it in the queue of incomplete executions.

Currently, the error handling directives can not be used out of the scope of an error handling route and Integromat does not offer a module that would enable you to easily conditionally generate (throw) errors.

Workaround - Using JSON Module

 

To conditionally throw an error you may configure a module to make it optionally purposely fail during its operation. One possibility is to employ JSON > Parse JSON module configured to optionally throw an error (BundleValidationError in this case):

You can then attach one of the error handling directives to the error handling route to:

  • force the scenario execution to stop and perform the rollback phase: Rollback
  • force the scenario execution to stop and perform the commit phase: Commit
  • stop the processing of a route: Ignore
  • stop the processing of a route and storing it in the queue of incomplete executions: Break

The following example shows the use of the Rollback directive:

 

Workaround - Using HTTP Module

 

Usecase - Retry after some time if no record found using Break Directive. Usually, this is crucial when your record doesn't update instantly and you would like to process it later on in automation. Using this Break directive could be handy with the lesser complexity of the setup.

Current Barrier - Integromat does not offer a module that would enable you to easily conditionally generate (throw) errors.

To give you a better understanding here is the current setup without modification: This scenario search in Zendesk if there is no use it won’t throw an error forcefully to search it again you would need to implement a complex procedure by saving the record.

 

mceclip0.png

 

Solution - To conditionally throw an error you may replace the module where you want to throw an error, with an HTTP module then perform the search in a second scenario linking the HTTP module using webhook with a second scenario. If no result found you can customize the module to throw an error

Scenario One - 

  • Replace the Module where you want to throw an error with HTTP > Make a Request module
  • Configure the URL within the query parameter that you will get from the Custom Webhook module and add an optional query parameter to search for the email
  • Enable the advanced settings and check the evaluate all the states as errors.

mceclip1.png

  • Add a Break handler in that HTTP module and configure the setup to run later.

mceclip2.png

 

Scenario 2 - 

  1. Setup Webhooks > Custom Webhooks as a trigger and copy the URL use it in the HTTP module as shown in the previous steps.
  2. Here use the Zendesk > Search for a User module use the parameter from the HTTP module to perform a query. Enable Continue the execution of the route even if the module returns no results
  3. Add a Router and create two routes 
    1. Setup the first filter for Record Exist
    2. The second one for Record Doesn’t exist
  4. Consecutively setup the webhook response module 
    1. If result found - send 200 status along with the required body in JSON format.
    2. If no result found - Send 4xx/404 and in the JSON no record found


mceclip3.png

 

The following example returning the result - You will notice when the Zendesk module executes the API it doesn’t send any error message but in the action, we’re replicating the error using the HTTP module.

 

Integromat.gif

 

Popular use cases from our blog

slack-automation-illustration

Slack Automation: 20 Free Templates to Get You Inspired

google-sheets-automation-alt

Google Sheets Automation for Ecommerce: 23 Free Templates

tweet-automation-illustration

How to Get Someone's Tweets Before Anyone Else Does

onboarding-automation-with-integromat-alt

How to Automate Employee Onboarding in Minutes with Integromat

shopify-order-to-manufacturer-illustration-alt

How to Auto Send Shopify Orders to Dropshipping Suppliers [Guide]

strava-exercise-to-google-sheets-illustration

Like a Champ: How to Save Strava Activities to Google Sheets

Didn’t find what you were looking for?

Ticket

Create a ticket

Contact our world-class support team and tell us what’s happening.

Create a ticket
Expert

Find an expert

We feature a network of 450+ certified partners across the globe who are ready to help

Find an expert

Automate any workflow in your business

Sign up for a free account today. No credit card required, no time limits on free plan.