diff Ikariam.pm @ 265:aaffc50e3318

try to handle db_error
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Tue, 25 Nov 2008 20:15:26 +0800
parents 83e3ce37779d
children 285d5b39ef2c
line wrap: on
line diff
--- a/Ikariam.pm	Mon Nov 24 17:44:43 2008 +0800
+++ b/Ikariam.pm	Tue Nov 25 20:15:26 2008 +0800
@@ -1,14 +1,29 @@
+
 BEGIN {
     foreach (((getpwuid($<))[7], $ENV{HOME}, $ENV{LOGDIR}, ".")) {
         require "$_/.eagleeye.pm" if (-f "$_/.eagleeye.pm");
     }
 }
 
+package Ikariam::Base;
+use strict;
+require Class::DBI::SQLite;
+use base qw(Class::DBI::SQLite);
+
+sub _db_error {
+    my ($self, %info) = @_;
+    my $msg = delete $info{msg};
+    die($msg);
+# return $self->_carp($msg, %info);
+}
+
+1;
+
 use Class::DBI::AutoLoader (
     dsn       => 'dbi:SQLite:dbname=ikariam.sqlite',
     options   => { RaiseError => 1 },
     tables    => ['cities', 'island', 'user', 'ally', 'report'],
-    use_base  => 'Class::DBI::SQLite',
+    use_base  => 'Ikariam::Base',
     namespace => 'Ikariam',
 );