Exception: Whatsapp::MessageFailed
- Defined in:
- lib/whatsapp/errors.rb
Overview
Raised when a message send operation fails.
Instance Attribute Summary collapse
-
#reason ⇒ String?
readonly
Failure reason.
-
#to ⇒ String
readonly
Recipient phone number.
Instance Method Summary collapse
-
#initialize(to:, reason: nil) ⇒ MessageFailed
constructor
A new instance of MessageFailed.
Constructor Details
#initialize(to:, reason: nil) ⇒ MessageFailed
Returns a new instance of MessageFailed.
58 59 60 61 62 |
# File 'lib/whatsapp/errors.rb', line 58 def initialize(to:, reason: nil) @to = to @reason = reason super("Failed to send message to #{to}: #{reason}") end |
Instance Attribute Details
#reason ⇒ String? (readonly)
Returns failure reason.
53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/whatsapp/errors.rb', line 53 class MessageFailed < Error attr_reader :to, :reason # @param to [String] recipient phone number # @param reason [String, nil] failure reason def initialize(to:, reason: nil) @to = to @reason = reason super("Failed to send message to #{to}: #{reason}") end end |
#to ⇒ String (readonly)
Returns recipient phone number.
53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/whatsapp/errors.rb', line 53 class MessageFailed < Error attr_reader :to, :reason # @param to [String] recipient phone number # @param reason [String, nil] failure reason def initialize(to:, reason: nil) @to = to @reason = reason super("Failed to send message to #{to}: #{reason}") end end |