Daniel Brötzmann pushed to branch master at gajim / gajim


Commits:
70c75c83 by wurstsalat at 2024-04-08T22:23:01+02:00
fix: HTTPFileTransfer: Improve error fallbacks

Fixes #11799

- - - - -


1 changed file:

- gajim/common/modules/httpupload.py


Changes:

=====================================
gajim/common/modules/httpupload.py
=====================================
@@ -307,6 +307,8 @@ def _on_finish(self, request: HTTPRequest) -> None:
             if request.get_error() == HTTPRequestError.CANCELLED:
                 self._log.info('Upload cancelled')
             else:
+                if not error:
+                    error = _('Upload could not be completed.')
                 transfer.set_error('http-response', error)
             return
 
@@ -333,7 +335,8 @@ class HTTPFileTransfer(FileTransfer):
     _errors = {
         'unsecure': _('The server returned an insecure transport (HTTP).'),
         'encryption-not-available': _('There is no encryption method available 
'
-                                      'for the chosen encryption.')
+                                      'for the chosen encryption.'),
+        'unknown': _('Unknown error.')
     }
 
     def __init__(self,
@@ -427,7 +430,7 @@ def _get_temp_path() -> Path:
 
     def set_error(self, domain: str, text: str = '') -> None:
         if not text:
-            text = self._errors[domain]
+            text = self._errors.get(domain) or self._errors['unknown']
 
         super().set_error(domain, text)
         self._cleanup()



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/70c75c83ee7ca176681f6044f1c726682cde5337

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/70c75c83ee7ca176681f6044f1c726682cde5337
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to