When using a DB backend different from BDB, the BDB constant may not be
defined, causing a NameError during error trapping in the main loop. Fix
this by defining our own DBFatal error that maps to BDB::Fatal in the
BDB case and is defined as an (unused) Exception for TokyoCabinet.
quit_msg = "server ERROR: " + e.message
too_fast = e.message.index("reconnect too fast")
retry
- rescue BDB::Fatal => e
- fatal "fatal bdb error: #{e.pretty_inspect}"
+ rescue DBFatal => e
+ fatal "fatal db error: #{e.pretty_inspect}"
DBTree.stats
# Why restart? DB problems are serious stuff ...
# restart("Oops, we seem to have registry problems ...")
exit 2
end
+module Irc
+ DBFatal = BDB::Fatal
+end
+
if BDB::VERSION_MAJOR < 4
fatal "Your bdb (Berkeley DB) version #{BDB::VERSION} is too old!"
fatal "rbot will only run with bdb version 4 or higher, please upgrade."
module Irc
+ class DBFatal < Exception ; end
+
if defined? BDB
# DBHash is for tying a hash to disk (using bdb).
# Call it with an identifier, for example "mydata". It'll look for