Class: AppleShove::APNS::WriteExceptionHandler
- Inherits:
-
Object
- Object
- AppleShove::APNS::WriteExceptionHandler
- Defined in:
- lib/apple_shove/apns/write_exception_handler.rb
Instance Attribute Summary collapse
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Instance Method Summary collapse
-
#initialize(exception) ⇒ WriteExceptionHandler
constructor
A new instance of WriteExceptionHandler.
- #reconnect? ⇒ Boolean
- #retry? ⇒ Boolean
- #rewrite? ⇒ Boolean
Constructor Details
#initialize(exception) ⇒ WriteExceptionHandler
Returns a new instance of WriteExceptionHandler.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/apple_shove/apns/write_exception_handler.rb', line 9 def initialize exception # defaults @message = "error sending notification: #{exception.class} - #{exception.}" @reconnect = false @rewrite = false @retry = false # known cases case exception when Errno::EPIPE @message = "broken pipe. reconnecting." @reconnect = true @rewrite = true @retry = true when Errno::ETIMEDOUT @message = "timeout. reconnecting." @reconnect = true @retry = true when OpenSSL::SSL::SSLError if exception..match 'bad write retry' @message = "SSL bad write. reconnecting." @reconnect = true @retry = true end end end |
Instance Attribute Details
#message ⇒ Object (readonly)
Returns the value of attribute message.
7 8 9 |
# File 'lib/apple_shove/apns/write_exception_handler.rb', line 7 def @message end |
Instance Method Details
#reconnect? ⇒ Boolean
40 41 42 |
# File 'lib/apple_shove/apns/write_exception_handler.rb', line 40 def reconnect? @reconnect end |
#retry? ⇒ Boolean
48 49 50 |
# File 'lib/apple_shove/apns/write_exception_handler.rb', line 48 def retry? @retry end |
#rewrite? ⇒ Boolean
44 45 46 |
# File 'lib/apple_shove/apns/write_exception_handler.rb', line 44 def rewrite? @rewrite end |