catch

Use the catch extension to catch errors that occur during an API call.

The catch extension takes the following form:
catch:
   - errors:
      - Error_1
      - Error_2
   - execute:
      assembly_1
   - errors:
      - Error_3
   - execute:
      assembly_2
   - default:
      assembly_3

The following table shows the properties of the catch extension:

Table 1. The properties of the catch extension
Property Required Description Type
errors Yes The errors for which the catch will activate. For a list of errors, see Error cases supported by assembly catches. Array (String)
execute Yes The section of the assembly that will execute when the catch is activated. Array (Object)
default No The section of the assembly that will execute when an error does not trigger other catches. It behaves in the same manner and has the same structure as execute Array (Object)
The following is an example of a catch extension:
    catch:
      - errors:
          - ConnectionError
          - JavaScriptError
        execute:
          - activity-log:
              title: activity-log
              content: activity
              error-content: payload
      - default:
          - activity-log:
              title: activity-log
              content: activity
              error-content: payload