Perhaps use `--detailed-exitcodes` and then check for either 1, 4 or 6 to indicate failure (or not 0 or 2)?  That way it'll also pick up on errors during the run and not just catalog compilation errors.