Exception: Playwright::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/playwright/errors.rb

Direct Known Subclasses

TimeoutError

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, message:, stack:) ⇒ Error

Returns a new instance of Error.

Parameters:

  • name (String)
  • message (String)
  • stack (Array<String>)


22
23
24
25
26
27
# File 'lib/playwright/errors.rb', line 22

def initialize(name:, message:, stack:)
  super("#{name}: #{message}")
  @name = name
  @message = message
  @stack = stack
end

Class Method Details

.parse(error_payload) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/playwright/errors.rb', line 4

def self.parse(error_payload)
  if error_payload['name'] == 'TimeoutError'
    TimeoutError.new(
      message: error_payload['message'],
      stack: error_payload['stack'].split("\n"),
    )
  else
    new(
      name: error_payload['name'],
      message: error_payload['message'],
      stack: error_payload['stack'].split("\n"),
    )
  end
end