Skip to content

Commit 445519b

Browse files
Use Appium's detailed error messages
Fix #35
1 parent e00964f commit 445519b

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

lib/appium_lib/common/patch.rb

+20-1
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,23 @@ def raw_execute(command, opts = {}, command_hash = nil)
8080
http.call verb, path, command_hash
8181
end # def
8282
end # class
83-
end if defined? Pry # module Selenium::WebDriver::Remote
83+
end if defined? Pry # module Selenium::WebDriver::Remote
84+
85+
# Print Appium's origValue error messages.
86+
class Selenium::WebDriver::Remote::Response
87+
def error_message
88+
val = value
89+
90+
case val
91+
when Hash
92+
msg = val['origValue'] || val['message'] or return 'unknown error'
93+
msg << " (#{ val['class'] })" if val['class']
94+
when String
95+
msg = val
96+
else
97+
msg = "unknown error, status=#{status}: #{val.inspect}"
98+
end
99+
100+
msg
101+
end
102+
end

0 commit comments

Comments
 (0)