Skip to content

Commit 6a7f056

Browse files
authored
Improve add-on submission error reporting (#42)
When exceptions are raised in submission, the exception itself is reported to the submitter, not the manifest._errors contents. This creates a less helpful comment e.g.: nvaccess/addon-datastore#5198 (comment) Tested by running createJson.py locally Also updated dependencies
1 parent 75e7a0c commit 6a7f056

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

_validate/createJson.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python
22

3-
# Copyright (C) 2022-2024 Noelia Ruiz Martínez, NV Access Limited
3+
# Copyright (C) 2022-2025 Noelia Ruiz Martínez, NV Access Limited
44
# This file may be used under the terms of the GNU General Public License, version 2 or later.
55
# For more details see: https://www.gnu.org/licenses/gpl-2.0.html
66

@@ -91,9 +91,8 @@ def _createDictMatchingJsonSchema(
9191
"""Refer to _validate/addonVersion_schema.json"""
9292
try:
9393
addonVersionNumber = MajorMinorPatch.getFromStr(manifest["version"])
94-
except ValueError:
95-
manifest._errors = f"Manifest version invalid {addonVersionNumber}"
96-
raise
94+
except ValueError as e:
95+
raise ValueError(f"Manifest version invalid {addonVersionNumber}") from e
9796

9897
try:
9998
addonData = {
@@ -116,8 +115,7 @@ def _createDictMatchingJsonSchema(
116115
"license": licenseName,
117116
}
118117
except KeyError as e:
119-
manifest._errors = f"Manifest missing required key '{e.args[0]}'."
120-
raise
118+
raise KeyError(f"Manifest missing required key '{e.args[0]}'.") from e
121119

122120
# Add optional fields
123121
homepage = manifest.get("url")
@@ -140,8 +138,7 @@ def _createDictMatchingJsonSchema(
140138
}
141139
)
142140
except KeyError as e:
143-
manifest._errors = f"Translation for {langCode} missing required key '{e.args[0]}'."
144-
raise
141+
raise KeyError(f"Translation for {langCode} missing required key '{e.args[0]}'.") from e
145142

146143
return addonData
147144

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ flake8==3.9.2
55
flake8-tabs==2.2.2
66

77
# Requirements for validate
8-
git+https://github.com/DiffSK/configobj@3e2f4cc#egg=configobj
9-
jsonschema==3.1
8+
configobj @ git+https://github.com/DiffSK/configobj@8be54629ee7c26acb5c865b74c76284e80f3aa31#egg=configobj
9+
jsonschema==4.23.0
1010

0 commit comments

Comments
 (0)