org.incendo.cloud.exception.AmbiguousNodeException: Ambiguous Node: test4 cannot be added as a child to test (All children: test2, test4)
The exception does not mention the name of the offending alias test3 at all, which makes searching for the cause tedious in projects that have a lot of commands with a lot of aliases. My project also allows users to define their own aliases, which makes the situation even more confusing. This PR aims to improve this message to make it immediately clear what the offending alias is. Running the same code now gives the following output:
org.incendo.cloud.exception.AmbiguousNodeException: Ambiguous Node: test4 cannot be added as a child to test because of ambiguous name test3 (All children: test2, test4)
This PR also adds an additional test case for duplicate aliases.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Running this code
this.commandManager.command(this.commandManager.commandBuilder("test").literal("test2", "test3")); this.commandManager.command(this.commandManager.commandBuilder("test").literal("test4", "test3"));throws the following exception:
The exception does not mention the name of the offending alias test3 at all, which makes searching for the cause tedious in projects that have a lot of commands with a lot of aliases. My project also allows users to define their own aliases, which makes the situation even more confusing. This PR aims to improve this message to make it immediately clear what the offending alias is. Running the same code now gives the following output:
This PR also adds an additional test case for duplicate aliases.