зеркало из https://github.com/mozilla/pjs.git
Make error messages in Litmus::DBI suck less by not going into an infinite error loop whenever something goes wrong :-)
This commit is contained in:
Родитель
d7855a47db
Коммит
050d5a75c7
|
@ -84,18 +84,25 @@ sub AUTOLOAD {
|
|||
|
||||
my $col = $self->find_column($name);
|
||||
if (!$col) {
|
||||
internalError("tried to call Litmus::DBI method $name which does not exist");
|
||||
lastDitchError("tried to call Litmus::DBI method $name which does not exist");
|
||||
}
|
||||
|
||||
return $self->$col(@args);
|
||||
}
|
||||
|
||||
|
||||
# DBI error handler for SQL errors:
|
||||
sub _croak {
|
||||
my ($self, $message, %info) = @_;
|
||||
internalError($message);
|
||||
lastDitchError($message);
|
||||
return;
|
||||
}
|
||||
|
||||
sub lastDitchError($) {
|
||||
my $message = shift;
|
||||
print "Error - Litmus has suffered a serious fatal internal error - $message";
|
||||
exit;
|
||||
}
|
||||
|
||||
# Get Class::DBI's default dbh options
|
||||
my $db_options = { __PACKAGE__->_default_attributes };
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче