Exception: OpenFec::ServerError

Inherits:
Error
  • Object
show all
Defined in:
lib/open_fec/error.rb

Overview

Raised for 5xx HTTP responses.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, status: nil, body: nil) ⇒ ServerError

Returns a new instance of ServerError.

Parameters:

  • message (String, nil) (defaults to: nil)
  • status (Integer, nil) (defaults to: nil)
  • body (Hash, String, nil) (defaults to: nil)


47
48
49
50
51
# File 'lib/open_fec/error.rb', line 47

def initialize(message = nil, status: nil, body: nil)
  @status = status
  @body   = body
  super(message || "Server error HTTP #{status}")
end

Instance Attribute Details

#bodyHash, ... (readonly)

Returns response body.

Returns:

  • (Hash, String, nil)

    response body



42
43
44
# File 'lib/open_fec/error.rb', line 42

def body
  @body
end

#statusInteger? (readonly)

Returns HTTP status code.

Returns:

  • (Integer, nil)

    HTTP status code



40
41
42
# File 'lib/open_fec/error.rb', line 40

def status
  @status
end