Skip to content

Commit 6383469

Browse files
[webdriver] Fix WebDriver error dunder methods (#46623)
* `super()` alone retrieves the superclass type. Calling `__init__()` on it actually runs the superclass constructor. * `BidiException` doesn't have an `error` attribute. This probably should have been `error_code`.
1 parent a822e35 commit 6383469

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

tools/webdriver/webdriver/bidi/error.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ class BidiException(Exception):
1212
error_code: ClassVar[str]
1313

1414
def __init__(self, message: str, stacktrace: Optional[str] = None):
15-
super()
15+
super().__init__()
1616

1717
self.message = message
1818
self.stacktrace = stacktrace
1919

2020
def __repr__(self):
2121
"""Return the object representation in string format."""
22-
return f"{self.__class__.__name__}({self.error}, {self.message}, {self.stacktrace})"
22+
return f"{self.__class__.__name__}({self.error_code}, {self.message}, {self.stacktrace})"
2323

2424
def __str__(self):
2525
"""Return the string representation of the object."""

tools/webdriver/webdriver/error.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class WebDriverException(Exception):
1616
status_code: ClassVar[str]
1717

1818
def __init__(self, http_status=None, status_code=None, message=None, stacktrace=None):
19-
super()
19+
super().__init__()
2020

2121
if http_status is not None:
2222
self.http_status = http_status

0 commit comments

Comments
 (0)