Exception: Feathr::Api::FeathrError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/feathr/api/feathr_error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status:, errors:) ⇒ FeathrError

Returns a new instance of FeathrError.



8
9
10
# File 'lib/feathr/api/feathr_error.rb', line 8

def initialize(status:, errors:)
  @status, @errors = status, errors
end

Instance Attribute Details

#errorsObject

Returns the value of attribute errors.



6
7
8
# File 'lib/feathr/api/feathr_error.rb', line 6

def errors
  @errors
end

#statusObject

Returns the value of attribute status.



6
7
8
# File 'lib/feathr/api/feathr_error.rb', line 6

def status
  @status
end

Instance Method Details

#to_sObject



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/feathr/api/feathr_error.rb', line 12

def to_s
  str = ""
  str += "Status #{ status }\n" unless status.to_s.empty?
  str += if errors.is_a? Hash
    errors.map{ |k, v| "#{ k }: #{ v }" }.join('; ')
  elsif errors.is_a? Array
    errors.join('; ')
  else
    errors.to_s
  end
end