As part of an automated pipeline, I'd like to run some data quality checks on the files being merged. To do this, I'm running a node.js script. If data quality constraints aren't met, I'd like to fail the pipeline with a message.
I've tried every suggested option in the following stack exchange article, but none are working: How do I fail a script running in Bitbucket Pipelines?
I can see in the output from the Pipeline that the exception is being thrown:

However, the pipeline is just carrying on to the next line in the bash script, rather than failing with the message that has been set.