Exception: Besepa::Errors::BesepaError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/besepa/errors/besepa_error.rb

Direct Known Subclasses

InvalidResourceError, ResourceNotFoundError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(error = nil, description = nil, http_status = nil, messages = nil) ⇒ BesepaError

Returns a new instance of BesepaError.



10
11
12
13
14
15
# File 'lib/besepa/errors/besepa_error.rb', line 10

def initialize(error=nil, description=nil, http_status=nil, messages=nil)
  @messages    = messages
  @http_status = http_status
  @description = description
  @error       = error
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



6
7
8
# File 'lib/besepa/errors/besepa_error.rb', line 6

def description
  @description
end

#errorObject (readonly)

Returns the value of attribute error.



5
6
7
# File 'lib/besepa/errors/besepa_error.rb', line 5

def error
  @error
end

#http_statusObject (readonly)

Returns the value of attribute http_status.



7
8
9
# File 'lib/besepa/errors/besepa_error.rb', line 7

def http_status
  @http_status
end

#messagesObject (readonly)

Returns the value of attribute messages.



8
9
10
# File 'lib/besepa/errors/besepa_error.rb', line 8

def messages
  @messages
end

Instance Method Details

#to_sObject



17
18
19
20
# File 'lib/besepa/errors/besepa_error.rb', line 17

def to_s
  status_string = @http_status.nil? ? "" : "(Status #{@http_status}) "
  "#{status_string}#{@error} (#{@description})"
end