Periodically check the system variable $LASTEXITCODE for anything that's non-zero. Otherwise, like I recommended, you can just strong-arm it back to 0 every time. A try-catch block won't work if it isn't throwing it to stderr, which just because it's non-zero doesn't mean it'll do that. This blog may help.
↧