Error message JSON path fixes in Editor Angular Controllers #6029
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue Description:
The exception thrown in metadata editor/editorBoard was not captured the correct returned JSON path. The example JSON looks like. It should be reason.data->{code, description, message}. There is an unknown "error" object in the controller.
There is no specific way to reproduce such exception. The exception can happens randomly for example, the backend store throws timeout or service not available. But there is some workaround to reproduce such issue. Go to this line of code
core-geonetwork/services/src/main/java/org/fao/geonet/api/records/MetadataInsertDeleteApi.java
Lines 192 to 196 in 695c20e
Place manual exception throwing code:
Build your project and go to editor board and delete any records:
Since there is forced exception throwing in the API, so an error response will be returned to the browser.
But the delete icon will keep spinning and no error message returned.
After the fix, the error message should be look like this:
There was a fix in one of the previous PR #5079 but this PR is not meant for backporting to 3.12 as there are problems when doing cherry pick. So I created this PR in order to backport partial of its solution into 3.12.
As this PR changed EditorController.js which will fix another place for unrecognized returned JSON in newly created record when exception happens:
After the fix: