diff options
Diffstat (limited to 'lib/json/common.rb')
-rw-r--r-- | lib/json/common.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/json/common.rb b/lib/json/common.rb index a30e4ce..05eaf26 100644 --- a/lib/json/common.rb +++ b/lib/json/common.rb @@ -103,7 +103,13 @@ module JSON MinusInfinity = -Infinity # The base exception for JSON errors. - class JSONError < StandardError; end + class JSONError < StandardError + def self.wrap(exception) + obj = new("Wrapped(#{exception.class}): #{exception.message.inspect}") + obj.set_backtrace exception.backtrace + obj + end + end # This exception is raised if a parser error occurs. class ParserError < JSONError; end |