Exception: Marinetraffic::MarinetrafficError
- Inherits:
-
StandardError
- Object
- StandardError
- Marinetraffic::MarinetrafficError
- Defined in:
- lib/marinetraffic/errors/marinetraffic_error.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#error_code ⇒ Object
readonly
Returns the value of attribute error_code.
-
#http_body ⇒ Object
readonly
Returns the value of attribute http_body.
-
#http_headers ⇒ Object
readonly
Returns the value of attribute http_headers.
-
#http_status ⇒ Object
readonly
Returns the value of attribute http_status.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Instance Method Summary collapse
-
#initialize(message = nil, http_status = nil, http_body = nil, http_headers = nil, error_code = nil) ⇒ MarinetrafficError
constructor
A new instance of MarinetrafficError.
- #to_s ⇒ Object
Constructor Details
#initialize(message = nil, http_status = nil, http_body = nil, http_headers = nil, error_code = nil) ⇒ MarinetrafficError
Returns a new instance of MarinetrafficError.
9 10 11 12 13 14 15 |
# File 'lib/marinetraffic/errors/marinetraffic_error.rb', line 9 def initialize(=nil, http_status=nil, http_body=nil, http_headers=nil, error_code=nil) @message = @http_status = http_status @http_body = http_body @http_headers = http_headers || {} @error_code = error_code end |
Instance Attribute Details
#error_code ⇒ Object (readonly)
Returns the value of attribute error_code.
4 5 6 |
# File 'lib/marinetraffic/errors/marinetraffic_error.rb', line 4 def error_code @error_code end |
#http_body ⇒ Object (readonly)
Returns the value of attribute http_body.
6 7 8 |
# File 'lib/marinetraffic/errors/marinetraffic_error.rb', line 6 def http_body @http_body end |
#http_headers ⇒ Object (readonly)
Returns the value of attribute http_headers.
7 8 9 |
# File 'lib/marinetraffic/errors/marinetraffic_error.rb', line 7 def http_headers @http_headers end |
#http_status ⇒ Object (readonly)
Returns the value of attribute http_status.
5 6 7 |
# File 'lib/marinetraffic/errors/marinetraffic_error.rb', line 5 def http_status @http_status end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
3 4 5 |
# File 'lib/marinetraffic/errors/marinetraffic_error.rb', line 3 def @message end |
Instance Method Details
#to_s ⇒ Object
17 18 19 20 |
# File 'lib/marinetraffic/errors/marinetraffic_error.rb', line 17 def to_s code_string = @error_code.nil? ? "" : "(Error #{@error_code}) " "#{code_string}#{@message}" end |