Skip to content

Commit 10c2062

Browse files
authored
Add 'from' to except (#503)
1 parent d676eed commit 10c2062

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

appium/webdriver/appium_service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def _get_main_script(self) -> Union[str, bytes]:
104104
'-e',
105105
'console.log(require.resolve("{}"))'.format(MAIN_SCRIPT_PATH)]).strip()
106106
except sp.CalledProcessError as e:
107-
raise AppiumServiceError(e.output)
107+
raise AppiumServiceError(e.output) from e
108108
return self._main_script
109109

110110
@staticmethod

appium/webdriver/errorhandler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ def check_response(self, response: Dict) -> None:
2626
super().check_response(response)
2727
except WebDriverException as wde:
2828
if wde.msg == 'No such context found.':
29-
raise NoSuchContextException(wde.msg, wde.screen, wde.stacktrace)
29+
raise NoSuchContextException(wde.msg, wde.screen, wde.stacktrace) from wde
3030
else:
3131
raise wde

appium/webdriver/extensions/remote_fs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ def push_file(self, destination_path: str,
7373
try:
7474
with open(source_path, 'rb') as f:
7575
file_data = f.read()
76-
except IOError:
76+
except IOError as e:
7777
message = f'source_path "{source_path}" could not be found. Are you sure the file exists?'
78-
raise InvalidArgumentException(message)
78+
raise InvalidArgumentException(message) from e
7979
base64data = base64.b64encode(file_data).decode('utf-8')
8080

8181
data = {

0 commit comments

Comments
 (0)