Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Extract error initialization to JsonError module

  • Loading branch information...
commit 9f85bb20e4e7138aec6c2b5e9752e8ea481655a2 1 parent 05b92c9
@mhoran mhoran authored
Showing with 9 additions and 9 deletions.
  1. +9 −9 lib/capybara/webkit/errors.rb
View
18 lib/capybara/webkit/errors.rb
@@ -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 @@ class NodeNotAttachedError < Capybara::ElementNotFound
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
Please sign in to comment.
Something went wrong with that request. Please try again.