Mentions légales du service

Skip to content

Better error message handling on unknown network in config

E. Madison Bray requested to merge embray/better-error-msg-for-unknown-net into master

updates the generated schema for Network to include a custom errorMsg on 'enum' which gives a complete list of available network names (as opposed to just the name of just one of the networks)

updates the algorithm for traversing the schema hierarchy for the most relevant errorMsg: previously if we had something like:

{
    'errorMsg': {'enum': 'custom error for enum'},
    'oneOf': [
        {'properties': {'name': 'enum': ['a', 'A']}}
        {'properties': {'name': 'enum': ['b', 'B']}}
    ]
}

the traversal did not go higher than the sub-schema in oneOf, and did not check for the 'errorMsg' in the parent schema.

with this fix, if an error occurs on 'enum' in one of the 'oneOf' sub-schemas, the error will bubble up to the 'errorMsg' in the parent schema.

the new test implicitly tests this case as well.

Note: This fix also affects unknown/misspelled optimizers.

Edited by E. Madison Bray

Merge request reports