Class: Bidi2pdf::Bidi::NavigationFailedEvents
- Inherits:
-
Object
- Object
- Bidi2pdf::Bidi::NavigationFailedEvents
- Defined in:
- lib/bidi2pdf/bidi/navigation_failed_events.rb
Instance Attribute Summary collapse
-
#browser_console_logger ⇒ Object
readonly
Returns the value of attribute browser_console_logger.
-
#context_id ⇒ Object
readonly
Returns the value of attribute context_id.
Instance Method Summary collapse
- #handle_event(data) ⇒ Object
- #handle_response(_method, event) ⇒ Object
-
#initialize(context_id) ⇒ NavigationFailedEvents
constructor
A new instance of NavigationFailedEvents.
Constructor Details
#initialize(context_id) ⇒ NavigationFailedEvents
10 11 12 |
# File 'lib/bidi2pdf/bidi/navigation_failed_events.rb', line 10 def initialize(context_id) @context_id = context_id end |
Instance Attribute Details
#browser_console_logger ⇒ Object (readonly)
Returns the value of attribute browser_console_logger.
8 9 10 |
# File 'lib/bidi2pdf/bidi/navigation_failed_events.rb', line 8 def browser_console_logger @browser_console_logger end |
#context_id ⇒ Object (readonly)
Returns the value of attribute context_id.
8 9 10 |
# File 'lib/bidi2pdf/bidi/navigation_failed_events.rb', line 8 def context_id @context_id end |
Instance Method Details
#handle_event(data) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/bidi2pdf/bidi/navigation_failed_events.rb', line 14 def handle_event(data) event = data["params"] method = data["method"] if event["context"] == context_id handle_response(method, event) else Bidi2pdf.logger.debug2 "Ignoring Log event: #{method}, context_id: #{context_id}, params: #{event}" end end |
#handle_response(_method, event) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/bidi2pdf/bidi/navigation_failed_events.rb', line 25 def handle_response(_method, event) url = event["url"] = event["navigation"] = event["timestamp"] Bidi2pdf.notification_service.instrument("navigation_failed_received.bidi2pdf", { url: url, timestamp: , navigation: }) Bidi2pdf.logger.error "Navigation failed for URL: #{url}, Navigation: #{}" end |