lib/lunanode/api_error.rb in lunanode-0.2.0 vs lib/lunanode/api_error.rb in lunanode-0.3.0
- old
+ new
@@ -5,11 +5,10 @@
module Lunanode
# A RuntimeError raised when the API call returns unsuccessfully.
class APIError < RuntimeError
def to_s
unescaped = CGI.unescapeHTML(super)
- return unescaped unless unescaped.start_with?("\"{")
- JSON.pretty_generate(JSON.parse(unescaped.gsub(/\A"|"\z/, "")))
+ JSON.pretty_generate(JSON.parse(unescaped))
rescue JSON::ParserError
unescaped
end
end
end