in reply to How to create an error log file?

Also, info on catching DBI errors from the DBI documentation. The important thing to note being that you can die in an eval block, but your perl script won't die.
perldoc -m DBI perldoc -f eval
Typically RaiseError is used in conjunction with eval { ... } to catch the exception that's been thrown and followed by an if ($@) { ... } block to handle the caught exception. For example:
eval { ... $sth->execute(); ... }; if ($@) { # $sth->err and $DBI::err will be true if error was from DBI warn $@; # print the error ... # do whatever you need to deal with the error }