More precise schema failure message
While creating schema for the add-on I used, I realized that my error message was not precise enough. For a big configuration such as in "Enhance main window", the message "None is not of type 'string'" is almost useless. So I added a path in the json config, to indicate where the error is. And also which subschema is currently being used.
This commit is contained in:
parent
4290bc81eb
commit
c9b89c5394
@ -1330,7 +1330,14 @@ class ConfigEditor(QDialog):
|
|||||||
except ValidationError as e:
|
except ValidationError as e:
|
||||||
# The user did edit the configuration and entered a value
|
# The user did edit the configuration and entered a value
|
||||||
# which can not be interpreted.
|
# which can not be interpreted.
|
||||||
showInfo(tr(TR.ADDONS_CONFIG_VALIDATION_ERROR, problem=e.message))
|
showInfo(
|
||||||
|
tr(
|
||||||
|
TR.ADDONS_CONFIG_VALIDATION_ERROR,
|
||||||
|
problem=e.message,
|
||||||
|
path="/".join(str(path) for path in e.path),
|
||||||
|
schema=str(e.schema),
|
||||||
|
)
|
||||||
|
)
|
||||||
return
|
return
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
showInfo(_("Invalid configuration: ") + repr(e))
|
showInfo(_("Invalid configuration: ") + repr(e))
|
||||||
|
@ -6,4 +6,4 @@ addons-failed-to-load =
|
|||||||
{$traceback}
|
{$traceback}
|
||||||
# Shown in the add-on configuration screen (Tools>Add-ons>Config), in the title bar
|
# Shown in the add-on configuration screen (Tools>Add-ons>Config), in the title bar
|
||||||
addons-config-window-title = Configure '{$name}'
|
addons-config-window-title = Configure '{$name}'
|
||||||
addons-config-validation-error = There was a problem with the provided configuration: {$problem}
|
addons-config-validation-error = There was a problem with the provided configuration: {$problem}, at path {$path}, against schema {$schema}.
|
Loading…
Reference in New Issue
Block a user