Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't manipulate exception backtrace. #13222

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
36 changes: 1 addition & 35 deletions rb/lib/selenium/webdriver/remote/response.rb
Expand Up @@ -38,11 +38,7 @@ def error
error, message, backtrace = process_error
klass = Error.for_error(error) || return

ex = klass.new(message)
ex.set_backtrace(caller)
add_backtrace ex, backtrace

ex
klass.new(message)
end

def [](key)
Expand All @@ -59,36 +55,6 @@ def assert_ok
raise Error::ServerError, self
end

def add_backtrace(ex, server_trace)
return unless server_trace

backtrace = case server_trace
when Array
backtrace_from_remote(server_trace)
when String
server_trace.split("\n")
end

ex.set_backtrace(backtrace + ex.backtrace)
end

def backtrace_from_remote(server_trace)
server_trace.filter_map do |frame|
next unless frame.is_a?(Hash)

file = frame['fileName']
line = frame['lineNumber']
meth = frame['methodName']

class_name = frame['className']
file = "#{class_name}(#{file})" if class_name

meth = 'unknown' if meth.nil? || meth.empty?

"[remote server] #{file}:#{line}:in `#{meth}'"
end
end

def process_error
return unless self['value'].is_a?(Hash)

Expand Down