class Octobat::OctobatError
Attributes
error[R]
http_body[R]
http_status[R]
json_body[R]
message[RW]
Public Class Methods
new(error=nil, http_status=nil, http_body=nil, json_body=nil)
click to toggle source
# File lib/octobat/errors/octobat_error.rb, line 9 def initialize(error=nil, http_status=nil, http_body=nil, json_body=nil) @error = error @http_status = http_status @http_body = http_body @json_body = json_body end
Public Instance Methods
generate_message_from_error()
click to toggle source
# File lib/octobat/errors/octobat_error.rb, line 25 def generate_message_from_error return "" if @error.nil? a = [] @error.each_key do |k| msg = k.eql?(:global) ? "" : "#{k.to_s}: " msg << "#{serialize_errors_from(@error[k])}" a << msg end a.join(". ") end
serialize_errors_from(err)
click to toggle source
# File lib/octobat/errors/octobat_error.rb, line 38 def serialize_errors_from(err) a = [] err.each do |e| a << "#{e[:details]}" end a.join(', ') end
to_s()
click to toggle source
# File lib/octobat/errors/octobat_error.rb, line 20 def to_s status_string = @http_status.nil? ? "" : "(Status #{@http_status}) " "#{status_string}#{message}" end