When the shell exits after an error (when that is the right thing for it to do) ensure that it never does exit(0).