Make SQL job fail if a DB error is encountered

Discussion created by Michael_Lowry on Jul 25, 2016
An Oracle SQL agent job was not working, so I enabled the Agent log to investigate. Then I discovered the reason. In the agent log, I saw that there was a problem with the username and/or password:
2016-07-25 10:26:27 - U02012031 The database driver returned the following error message:
2016-07-25 10:26:27             ORA-01017: invalid username/password; logon denied
The job remained in the Active status, even though an Oracle DB error had been encountered. Is there a way to force the job to end in error in such situations? Also, is there a way to include the Agent log automatically, but only on error?