lib/xamplr/persister.rb in xamplr-1.9.6 vs lib/xamplr/persister.rb in xamplr-1.9.7

- old
+ new

@@ -136,10 +136,15 @@ when nil, :xml_format then return xampl.persist("", mentions) when :ruby_format then return xampl.to_ruby(mentions) end + rescue => e + msg = "Failed to represent #{ xampl } due to: #{ e }" + puts msg + puts e.backtrace + raise msg end def realise(representation, target=nil) # Normally we'd expect to see the representation in the @format format, but # that isn't necessarily the case. Try to work out what the format might be... @@ -343,17 +348,21 @@ begin if require 'tokyocabinet' then require "xamplr/persisters/tokyo-cabinet" end + rescue LoadError => e + # Well. No Tokyo Cabinet. rescue # Well. No Tokyo Cabinet. end begin if require 'mongo' then require "xamplr/persisters/mongo" end + rescue LoadError => e + # Well. No MongoDB. rescue # Well. No MongoDB. end end