lib/moneta/api/http_exception.rb in moneta-api-1.7.0 vs lib/moneta/api/http_exception.rb in moneta-api-1.8.0

- old
+ new

@@ -1,5 +1,25 @@ module Moneta module Api - class HTTPException < Exception; end + class HTTPException < Exception + attr_reader :code + + def initialize(code, message) + super(message) + + @code = code + end + + + def inspect + "#{ @code }: #{ message }" + end + + def to_hash + { + code: code, + message: message, + } + end + end end end