diff options
author | Nino van Hooff <ninovanhooff@gmail.com> | 2020-03-19 14:30:14 +0300 |
---|---|---|
committer | Nino van Hooff <ninovanhooff@gmail.com> | 2020-03-19 14:30:14 +0300 |
commit | 6f4276c5cce2148ac1426b3b5c7285d4d6ff493b (patch) | |
tree | 7de0b98f895df0017a20830dcb53bb4fc0fa3590 /plugins/CuraDrive | |
parent | 7f6afb9638b2bf095c7af83c99a03c845f76690b (diff) |
Fix mypy issue in CreateBackupJob
CURA-7173
Diffstat (limited to 'plugins/CuraDrive')
-rw-r--r-- | plugins/CuraDrive/src/CreateBackupJob.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/plugins/CuraDrive/src/CreateBackupJob.py b/plugins/CuraDrive/src/CreateBackupJob.py index a9352cb691..999e70d64e 100644 --- a/plugins/CuraDrive/src/CreateBackupJob.py +++ b/plugins/CuraDrive/src/CreateBackupJob.py @@ -98,7 +98,11 @@ class CreateBackupJob(Job): if HttpRequestManager.safeHttpStatus(reply) == 400: errors = json.loads(replyText)["errors"] if "moreThanMaximum" in [error["code"] for error in errors if error["meta"] and error["meta"]["field_name"] == "backup_size"]: - sentry_sdk.capture_message("backup failed: exceeded max size: {}".format(len(self._backup_zip)), level = "warning") + if self._backup_zip is None: # will never happen; keep mypy happy + zip_error = "backup is None." + else: + zip_error = "{} exceeds max size.".format(str(len(self._backup_zip))) + sentry_sdk.capture_message("backup failed: {}".format(zip_error), level ="warning") self.backup_upload_error_message = catalog.i18nc("@error:file_size", "The backup exceeds the maximum file size.") from sentry_sdk import capture_message |