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:
zach%zachlipton.com 2006-10-04 19:47:06 +00:00
Родитель d7855a47db
Коммит 050d5a75c7
1 изменённых файлов: 10 добавлений и 3 удалений

Просмотреть файл

@ -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 };