I prefer to write solid shell code, so the errexit & nounset is alway set.
The following code will stop at bad_command line
#!/bin/b
Agree with comments, so if you can give up errexit then you can easily shorten your code to
errexit
bad_command || do_err_handle good_command
I hope this helps.