http://www.perlmonks.org?node_id=1005664


in reply to Re: DBI can't catch error
in thread DBI can't catch error

ok, that easy.

So simplified it will be something like

# Connect to MySQL server $Dbh = DBI->connect($DSN, $Config{'MYSQL_USER'}, $Config{'MYSQL_PASSWD +'}, { PrintError => 0, RaiseError => 0 }); # Check if connect went ok if (defined ($Dbh)) { # Good print "Successful connection with DB"; } else { # Problem! print "We had an error connecting to DB: ".$DBI::errstr; exit; }