Remove unnecessary tests for the error type or at least push them in error paths.