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 $dbuser = $self->qp->config("vpopmail_mysql_user") || "vpopmailuser";
|
||||||
my $dbpass = $self->qp->config("vpopmail_mysql_pass") || "vpoppasswd";
|
my $dbpass = $self->qp->config("vpopmail_mysql_pass") || "vpoppasswd";
|
||||||
|
|
||||||
my $dbh = DBI->connect($dsn, $dbuser, $dbpass) or do {
|
my $dbh;
|
||||||
$self->log(LOGERROR, "skip: db connection failed");
|
eval { $dbh = DBI->connect($dsn, $dbuser, $dbpass); };
|
||||||
|
if (!$dbh) {
|
||||||
|
$self->log(LOGERROR, "skip: db connection failed: $!");
|
||||||
|
$self->log(LOGERROR, $@) if $@;
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
$dbh->{ShowErrorStatement} = 1;
|
$dbh->{ShowErrorStatement} = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user