mirror of
https://github.com/samschott/maestral.git
synced 2024-10-06 10:28:07 +03:00
always set __cause__ of translated exceptions
This commit is contained in:
parent
0829495d2e
commit
61444e856d
@ -109,12 +109,12 @@ def to_maestral_error(dbx_path_arg=None, local_path_arg=None):
|
||||
try:
|
||||
return func(*args, **kwargs)
|
||||
except dropbox.exceptions.DropboxException as exc:
|
||||
raise dropbox_to_maestral_error(exc, dbx_path, local_path) from exc
|
||||
raise dropbox_to_maestral_error(exc, dbx_path, local_path)
|
||||
# catch connection errors first, they may inherit from OSError
|
||||
except CONNECTION_ERRORS:
|
||||
raise ConnectionError('Cannot connect to Dropbox')
|
||||
except OSError as exc:
|
||||
raise os_to_maestral_error(exc, dbx_path, local_path) from exc
|
||||
raise os_to_maestral_error(exc, dbx_path, local_path)
|
||||
|
||||
return wrapper
|
||||
|
||||
|
@ -216,7 +216,10 @@ def os_to_maestral_error(exc, dbx_path=None, local_path=None):
|
||||
else:
|
||||
return exc
|
||||
|
||||
return err_cls(title, text, dbx_path=dbx_path, local_path=local_path)
|
||||
maestral_exc = err_cls(title, text, dbx_path=dbx_path, local_path=local_path)
|
||||
maestral_exc.__cause__ = exc
|
||||
|
||||
return maestral_exc
|
||||
|
||||
|
||||
def dropbox_to_maestral_error(exc, dbx_path=None, local_path=None):
|
||||
@ -424,7 +427,10 @@ def dropbox_to_maestral_error(exc, dbx_path=None, local_path=None):
|
||||
title = 'An unexpected error occurred'
|
||||
text = exc.args[0]
|
||||
|
||||
return err_cls(title, text, dbx_path=dbx_path, local_path=local_path)
|
||||
maestral_exc = err_cls(title, text, dbx_path=dbx_path, local_path=local_path)
|
||||
maestral_exc.__cause__ = exc
|
||||
|
||||
return maestral_exc
|
||||
|
||||
|
||||
def _get_write_error_msg(write_error):
|
||||
|
Loading…
Reference in New Issue
Block a user