GEOS
GEOS copied to clipboard
[EPIC] Improve feedback to user on XML errors
Typical XML user syntax, path and naming errors (additional commas or spaces, misplaced slash, missing fields) produce messages in the standard output which consistency and readibility by a user can be improved.
error improvement exemples.pdf general presentation.pdf
- [x] General need: To indicate from where an error comes from, we could output it to the user in the message GEOS PRs:
- #2404
- #2447
- #2448
- #2449
- #2450
- [x] Case 1 - When adding a comma at start, end or between the entries of a {materialList, cellBlocks, cellBlockNames, phaseName, targetRegions}.
- Typical current output:
Controlling expression (should be false): inputStream.peek() != '}'
- Suggested output:
"wellPressureCollection": Empty entry in line "{ water, ,rock }". Please remove a comma or add an entry.
- GEOS PR #2357
- LvArray PR #280
- [x] Case 2.1 - Enter a wrong objectPath in a PackCollection.
- Typical current output:
std::bad_alloc
/Segmentation fault
- Suggested output:
wellPressureCollection: Specified name (wellRegion1) did not find a match with a object in group (ElementRegions).
Objects that are present in (ElementRegions) are:
reservoir, wellRegion
- GEOS PR #2341
- [x] Case 2.2 - Enter a wrong objectPath in general
- Typical current output:
Group m/ElementRegion does not have a child wellRegion
- Suggested output:
Error in initialPressure objectPath : Group ElementRegions doesn't have a child named wellRegion123. ElementRegions have the following children: wellRegion1,wellRegion2,meshRegion1
- GEOS PR #2341
- [x] Case 3 - Enter a wrong fieldName
- Typical current output:
Group m/domain/MeshBodies/cartesianMesh/meshLevels/Level0/ElementRegions/elementRegionsGroup/reservoir/elementSubRegions/cellBlock doesn't have a child pressures
- Suggested output:
"initialPressure": couldn'd find a field "pressures" in "ElementRegions/reservoir1"
Could be one of : pressure, globalCompFraction
Error happened while checking the children of
m/domain/MeshBodies/cartesianMesh/meshLevels/Level0/ElementRegions/elementRegionsGroup/reservoir/elementSubRegions/cellBlock.
- GEOS PR #2449
- [ ] Case 4 - Enter an empty
CompositionalMultiphaseFVM::targetRegions
,materialList
,cellBlockNames
- Typical current output:
Group m/domain/MeshBodies/cartesianMesh/meshLevels/Level0/ElementRegions/elementRegionsGroup doesn't have a child -1
- Suggested output:
"reservoir" must have cellBlocks.
- [x] Case 5.1 - Enter a forbiden characters (like
,
or/
) in a name field - Typical current output:
Group m/Solvers/compositionalMultiphaseWell doesn't have a child wellControls
(the error happens when we reference the object which name ends with a space) - Suggested output:
"cartesianMesh " name field cannot contain forbidden characters.
- GEOS PR #2764
- [x] Case 5.2 - Enter a forbiden characters (like
,
or/
) in a name field reference - Typical current output:
Error detected while parsing string: "wellControls "
- Suggested output:
"wellInjector1" wellControlsName field must not contain forbidden characters.
- GEOS PR #2764
- [x] Case 5.3 - Enter an objectPath with forbiden special characters in it (like
,
or/
) - Typical current outputs:
->
Group m/domain/MeshBodies/cartesianMesh/meshLevels/Level0/ElementRegions/elementRegionsGroup/wellRegion/elementSubRegions doesn't have a child wellRegionUniqueSubRegion_
->Error detected while parsing string: "ElementRegions/wellRegion/wellRegionUniqueSubRegion "
- Suggested output:
Group "wellPressureCollection" objectPath "wellRegionUniqueSubRegion_" cannot contain forbidden characters.
- GEOS PR #2764
Side note
These suggested messages could change, they must be followed by the stacktrace, and their goal is to contain all needed information for a developper to debug and for a user to understand his mistake in his xml.
Can you put the actual error message close to the desired error message? It's complicated to follow...
Hurray @MelReyCG , this is done. I let you the pleasure to tick the boxes!
EDIT: what about case 4?
I re-run the tests I made for this EPIC, and this point is not solved yet (the error is still the same).
I'll submit a last PR to solve it, we need to be able to specify if an X_array
is allowed to be empty.