If you fail to connect $Dbh will be undef. If $Dbh is not undef, you connected. So check $Dbh not $DBI::err.
In reply to Re: DBI can't catch error by mje in thread DBI can't catch error by gepebril69