cylc-flow icon indicating copy to clipboard operation
cylc-flow copied to clipboard

job: traceback style error reporting

Open oliver-sanders opened this issue 3 years ago • 0 comments

It isn't especially clear where errors come from in Bash scripts. This is especially true of the Cylc job script as it is auto-generated.

Cylc offers xtrace output when run in --debug mode, however, this is not a well known feature and the resultant output requires understanding of the job script structure to interpret.

It would be great if we could at least highlight the line number of an error by default (not just in --debug mode). I bumped into this script which traps errors and outputs user-friendly tracebacks in their place.

Seems simple enough, it essentially boils down to:

echo "Error in ${BASH_SOURCE[1]}:${BASH_LINENO[0]} ('$bash_command' exited with status $?)" >&2

Suggest adding something like this into our job file trapping.

Pull requests welcome!

oliver-sanders avatar Aug 01 '22 11:08 oliver-sanders