Running knife ssh commands from bash script

We automate a full streamed pipeline and part of it is bash scripts that call knife ssh commands. If the chef recipe fails on the knife ssh call, the bash script still reports a successful execute. I know why this happens I just need to know how to forward the failed Chef error to the bash script so it can error out properly and exit on a 1.

Another solution that would help would be knowing how to capture the error output from a knife ssh call into a conditional so bash can exit with a error properly.