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.
In the context of introducing the custom standardized error responses in the backend we had to do some refactoring so that all exceptions are handled and converted to the ProblemDetail object.
We realized that we are using in many places the default
NoSuchElementException
, which is thrown, when on a Optional theorElseThrow()
is used. We wanted to replace this default with a custom one, like maybe using theMandatoryNodeNotFoundException
. But we realized that many of this default usage comes when trying to get the eId of an element.We started therefore reformating the fromNode function of the Eid class so that not an optional is returned, since we know all/many elements MUST have an eId. We could then just filter out those elements passed to that function that do not belong to the list of nodes with mandatory eId.
But we realized that firstly with LDML.de 1.7 almost every XML node will get a mandatory eId (like for example akn:meta and many children there). Therefore we park this implementation for when:
We added for now an exception handler for the
NoSuchElementException
as a fallback till we go on with this work.