Exception: Whatsapp::BridgeError
- Defined in:
- lib/whatsapp/errors.rb
Overview
Raised when the Node bridge returns an HTTP error response.
Instance Attribute Summary collapse
-
#body ⇒ Hash?
readonly
Parsed response body.
-
#status_code ⇒ Integer?
readonly
HTTP status code from the bridge.
Instance Method Summary collapse
-
#initialize(msg = "Bridge returned an error", status_code: nil, body: nil) ⇒ BridgeError
constructor
A new instance of BridgeError.
Constructor Details
#initialize(msg = "Bridge returned an error", status_code: nil, body: nil) ⇒ BridgeError
Returns a new instance of BridgeError.
33 34 35 36 37 |
# File 'lib/whatsapp/errors.rb', line 33 def initialize(msg = "Bridge returned an error", status_code: nil, body: nil) @status_code = status_code @body = body super(msg) end |
Instance Attribute Details
#body ⇒ Hash? (readonly)
Returns parsed response body.
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/whatsapp/errors.rb', line 27 class BridgeError < Error attr_reader :status_code, :body # @param msg [String] error message # @param status_code [Integer, nil] HTTP status code # @param body [Hash, nil] parsed response body def initialize(msg = "Bridge returned an error", status_code: nil, body: nil) @status_code = status_code @body = body super(msg) end end |
#status_code ⇒ Integer? (readonly)
Returns HTTP status code from the bridge.
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/whatsapp/errors.rb', line 27 class BridgeError < Error attr_reader :status_code, :body # @param msg [String] error message # @param status_code [Integer, nil] HTTP status code # @param body [Hash, nil] parsed response body def initialize(msg = "Bridge returned an error", status_code: nil, body: nil) @status_code = status_code @body = body super(msg) end end |