Workflow Hub runtime now supports handling of errors as described in the serverless workflow specification.

The runtime identifies the error types via the error code, allowing you to use domain-specific names for your errors.

The runtime recognizes the following error codes:

  • RESTXXX: The response code followed by REST can handle errors arising from a REST request having the specified response code. Example: REST404 can be used to handle errors arising from a REST request with a 404 response code.

  • REST: This error code can be used to handle any REST error.

  • ASYNC: This error code can be used to handle async function errors.

  • SUBFLOW: This error code can be used to handle errors arising from sub-workflow failures.

  • PARALLEL: This error code can be used to handle errors from parallel actions, for example, for each state in parallel mode, parallel state.

  • ERROR: This error code can be used to handle any of the defined errors mentioned above.

Following is an example of error handling snippet:
errors:


 - name: "NodePoolNotFound"
   code: "REST404"
   description: Indicates that the requested resource does not exist.


states:
  - name: Query_NodePool
     type: operation
     actions:
       - functionRef:
           refName: getNodePool
           arguments:
             tca: "${ .tca }"
             Accept: application/json
             Content-Type: application/json
             x-hm-authorization: '${ ."x-hm-authorization" }'
             clusterUUID: "${ .clusterUUID }"
             mgmtClusterName: "${ .mgmtClusterName }"
             tcaCpId: "${ .tcaCpId }"
             nodepoolName: "${ .metadata.name }"
             orgId: '${.orgId}'
     onErrors: 
       - errorRefs:
           - NodePoolNotFound
         transition: Create_NodePool
     transition: Skip_Create_NodePool