lib/qonfig/loaders/json.rb in qonfig-0.16.0 vs lib/qonfig/loaders/json.rb in qonfig-0.17.0
- old
+ new
@@ -5,13 +5,19 @@
class Qonfig::Loaders::JSON < Qonfig::Loaders::Basic
class << self
# @param data [String]
# @return [Object]
#
+ # @raise [Qonfig::JSONLoaderParseError]
+ #
# @api private
# @since 0.5.0
def load(data)
::JSON.parse(data, max_nesting: false, allow_nan: true)
+ rescue ::JSON::ParserError => error
+ raise(Qonfig::JSONLoaderParseError.new(error.message).tap do |exception|
+ exception.set_backtrace(error.backtrace)
+ end)
end
# @return [Object]
#
# @api private