mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-04-15 09:51:21 +00:00
backups: Fix robust handling of known errors
During functional tests, it was noticed that getattr() failed at the following
line. The original intent of the code is to ensure that there are no failures
when 'stdout'/'stderr' attribute are not present or when they return None.
stdout = (getattr(err, 'stdout') or b'').decode()
Tests:
- Make the UI raise incorrect password error. Notice that the error is shown
properly.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
This commit is contained in:
parent
daca4d1d9c
commit
647e72516c
@ -118,8 +118,8 @@ def reraise_known_errors(privileged_func):
|
||||
|
||||
def _reraise_known_errors(err):
|
||||
"""Look whether the caught error is known and reraise it accordingly"""
|
||||
stdout = (getattr(err, 'stdout') or b'').decode()
|
||||
stderr = (getattr(err, 'stderr') or b'').decode()
|
||||
stdout = (getattr(err, 'stdout', b'') or b'').decode()
|
||||
stderr = (getattr(err, 'stderr', b'') or b'').decode()
|
||||
caught_error = str((err, err.args, stdout, stderr))
|
||||
for known_error in KNOWN_ERRORS:
|
||||
for error in known_error['errors']:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user