auth_vpopmail_sql: wrap DB connect attempt in eval
This commit is contained in:
parent
7396dbbf5f
commit
0b38c21f40
@ -94,8 +94,11 @@ sub get_db_handle {
|
||||
my $dbuser = $self->qp->config("vpopmail_mysql_user") || "vpopmailuser";
|
||||
my $dbpass = $self->qp->config("vpopmail_mysql_pass") || "vpoppasswd";
|
||||
|
||||
my $dbh = DBI->connect($dsn, $dbuser, $dbpass) or do {
|
||||
$self->log(LOGERROR, "skip: db connection failed");
|
||||
my $dbh;
|
||||
eval { $dbh = DBI->connect($dsn, $dbuser, $dbpass); };
|
||||
if (!$dbh) {
|
||||
$self->log(LOGERROR, "skip: db connection failed: $!");
|
||||
$self->log(LOGERROR, $@) if $@;
|
||||
return;
|
||||
};
|
||||
$dbh->{ShowErrorStatement} = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user