I have a command in a script to do a 'backup database [name] to [file] and all the other parameters.
Now, we have a problem where we run out of disk space, the script keeps on trucking, just issuing the message:
BACKUP DATABASE is terminating abnormally.
As if there is no problem… no exception is tossed, or anything… so the next command in the series, to do a restore of that database to another database… fails… and the script keeps on running…
Why doesn't it throw an exception when there is a catastrophic failure like either of these?
I've seen some suggestions that we should query log files to see if there was a database backup failure, but good grief, it should just DIE when you run the script.
Do I need to catch the exception, and throw the exception with a higher severity (I'd assume that the other one is thrown with the max severity, but maybe someone thought that a complete failure of a backup is just minor?)
I've seen other code / questions where people are doing a try/catch around the backup, but I have no interest in catching the exception, I want it to Abort right there, die, and report the error up the chain..
Instead, it just keeps going..