Exception: Lunanode::APIError

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/lunanode/api_error.rb

Overview

A RuntimeError raised when the API call returns unsuccessfully.

Instance Method Summary collapse

Instance Method Details

#to_sObject


8
9
10
11
12
13
14
# File 'lib/lunanode/api_error.rb', line 8

def to_s
  unescaped = CGI.unescapeHTML(super)
  return unescaped unless unescaped.start_with?("\"{")
  JSON.pretty_generate(JSON.parse(unescaped.gsub(/\A"|"\z/, "")))
rescue JSON::ParserError
  unescaped
end