---
schema_version: "1"
id: 22b69e339e3b614f859452eda722827fe28577f8cb7e860c4cc98a81b21b0817
title: Handle Errors Using Try-Catch Blocks (Managed Package)
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/xcloud/264-0-0/os_handle_errors_using_try_catch_blocks.md
canonical_url: https://help.salesforce.com/s/articleView?id=xcloud.os_handle_errors_using_try_catch_blocks.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 498c268ad6f6c0d09ed5298d411e7809e08f1978470286fa5dc3cb63001ec876
description: For the managed package runtime, a Try-Catch Block lets you "try" running the steps inside it and then "catch" the error if a step fails.
products:
  - Omnistudio
release: "264"
---
# Handle Errors Using Try-Catch Blocks (Managed Package)

For the managed package runtime, a Try-Catch Block lets you "try" running the steps inside it and then "catch" the error if a step fails.

![Managed Package app icon](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio_for_managed_packages-264-0-0-production-enus/aa2554ec-624a-4ee6-8da4-6435670e6e62/resources-global/_corporate/images/managedpackageicon.png) This information is for Omnistudio for Managed Packages. For Omnistudio on standard runtime, see [Omnistudio Help](https://help.salesforce.com/s/articleView?id=xcloud.os_omnistudio_standard.htm&language=en_US).

Try-Catch Blocks are available in Summer '19 and later releases.

To set up a Try-Catch Block:

1. Drag a Try-Catch Block into the Structure panel and make sure its **Fail on Block Error** checkbox is checked.
2. Configure the "catch" behavior — what the Try-Catch Block will do if a failure occurs. You can choose one or both of these options:
    
    - Under **Failure Response**, specify a key-value pair to return as the response. The value can be a formula. In Spring '20 and later releases, the value can include merge fields.
    - Under **Custom Failure Response**, specify a Remote Class and a Remote Method to execute an Apex class. The Apex class must implement VlocityOpenInterface.
3. Drag substeps into the Try-Catch Block, and make sure the **Fail on Step Error** checkbox is checked for each step that must trigger the "catch" behavior if it fails.
    
    You can optionally specify a **Failure Condition Formula**, which evaluates to TRUE if a specific step has failed to execute successfully.

- **[Try-Catch Block Properties (Managed Package)](https://help.salesforce.com/s/articleView?id=xcloud.os_try_catch_block_properties.htm&release=264.0.0&type=5)**  
    For the managed package runtime, these properties are unique to or function in a unique manner in Try-Catch Blocks. A Try-Catch Block lets you "try" running the steps inside it and then "catch" the error if a step fails.
- **[Create a Try-Catch Block Example (Managed Package)](https://help.salesforce.com/s/articleView?id=xcloud.os_create_a_try_catch_block_example.htm&release=264.0.0&type=5)**  
    For the managed package runtime, an Integration Procedure creates and deletes a Contact with the specified LastName and returns an error message if the LastName is blank.
- **[Create a Try-Catch Block Example with a Formula (Managed Package)](https://help.salesforce.com/s/articleView?id=xcloud.os_create_a_try_catch_block_example_with_a_formula.htm&release=264.0.0&type=5)**  
    For the managed package runtime, an Integration Procedure finds Contacts with the specified Name and returns an error message if none are found. Because returning no records normally isn't considered a failure, the Omnistudio Data Mapper Extract Action within the Try-Catch Block includes a Failure Condition Formula.