Skip to content

Commit

Permalink
Don't print duplicate error message in chrome (pyodide#1144)
Browse files Browse the repository at this point in the history
In chrome, the error message is contained in the stack. Avoid printing
it twice.
  • Loading branch information
dalcde authored Jan 16, 2021
1 parent 3fef124 commit 293fefa
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ class JavascriptException(Exception):
def __init__(self, msg, stack):
self.msg = msg
self.stack = stack
# In chrome the stack contains the message
if self.stack and self.stack.startswith(self.msg):
self.msg = ""

def __str__(self):
if self.stack:
return self.msg + "\n\n" + self.stack
else:
return self.msg
return "\n\n".join(x for x in [self.msg, self.stack] if x)


class SeleniumWrapper:
Expand Down

0 comments on commit 293fefa

Please sign in to comment.