Best practice for workflow error handling

Describe the problem/error/question

I’m having trouble understanding how to catch errors and have them trigger my workflow that starts with an ‘error trigger’.

Let’s say I have the following workflow and the script throws a non-zero output

Share the output returned by the last node

{
   "code": 127,
   "signal": null,
   "stdout": "",
   "stderr": "bash: line 1: ansible-plybook: command not found"
}

and I configured the workflow to trigger the ‘error’ workflow I created on error.

I had thought / hoped that this would trigger the ‘error’ workflow if my script exited with a non-zero exit code, but it does not. Any thoughts?

I use execute command as demo since their output are quite the same.

stderr usually shows the error message. Use a switch to catch it and doing the following. Like you can add an IF node to determine is there string contains non-zero exit code.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.