mirror of
https://github.com/thoughtbot/capybara-webkit
synced 2023-03-27 23:22:28 -04:00
Extract error initialization to JsonError module
This commit is contained in:
parent
05b92c9bf0
commit
9f85bb20e4
1 changed files with 9 additions and 9 deletions
|
@ -1,10 +1,14 @@
|
|||
module Capybara::Webkit
|
||||
class InvalidResponseError < StandardError
|
||||
def self.json_create(o)
|
||||
new(o["message"])
|
||||
module JsonError
|
||||
def json_create(attributes)
|
||||
new(attributes["message"])
|
||||
end
|
||||
end
|
||||
|
||||
class InvalidResponseError < StandardError
|
||||
extend JsonError
|
||||
end
|
||||
|
||||
class NoResponseError < StandardError
|
||||
end
|
||||
|
||||
|
@ -12,14 +16,10 @@ module Capybara::Webkit
|
|||
end
|
||||
|
||||
class ClickFailed < StandardError
|
||||
def self.json_create(o)
|
||||
new(o["message"])
|
||||
end
|
||||
extend JsonError
|
||||
end
|
||||
|
||||
class TimeoutError < Timeout::Error
|
||||
def self.json_create(o)
|
||||
new(o["message"])
|
||||
end
|
||||
extend JsonError
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue