Class: Deepstream::ErrorHandler
- Inherits:
-
Object
- Object
- Deepstream::ErrorHandler
- Defined in:
- lib/deepstream/error_handler.rb
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
Instance Method Summary collapse
-
#initialize(client) ⇒ ErrorHandler
constructor
A new instance of ErrorHandler.
- #on_error(message) ⇒ Object
- #on_exception(exception) ⇒ Object
Constructor Details
#initialize(client) ⇒ ErrorHandler
Returns a new instance of ErrorHandler.
9 10 11 12 |
# File 'lib/deepstream/error_handler.rb', line 9 def initialize(client) @client = client @error = nil end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
7 8 9 |
# File 'lib/deepstream/error_handler.rb', line 7 def error @error end |
Instance Method Details
#on_error(message) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/deepstream/error_handler.rb', line 14 def on_error() @error = if .is_a?(Message) .topic == TOPIC::ERROR ? .data : Helpers.to_type(.data.last) else end puts "#{@error}\n" unless @client.[:debug] end |
#on_exception(exception) ⇒ Object
24 25 26 27 |
# File 'lib/deepstream/error_handler.rb', line 24 def on_exception(exception) raise exception if @client.[:debug] puts "\n#{exception.}\n#{exception.backtrace}\n" end |