Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Suggestion] Add exception type for command execution failure #100

Open
Marcono1234 opened this issue Oct 8, 2021 · 0 comments
Open

[Suggestion] Add exception type for command execution failure #100

Marcono1234 opened this issue Oct 8, 2021 · 0 comments

Comments

@Marcono1234
Copy link

Currently the only existing exception type is CommandSyntaxException, wich is also used by Command.run(CommandContext<S>).

However, in most (if not all) cases exceptions thrown by run are unrelated to the syntax of the command, they are rather related to the state of the application (e.g. the state of the Minecraft world). Therefore it might be good to add a new separate exception type, such as CommandExecutionException and add it as thrown exception type to run.
Assuming that this would be a checked exception type, such a change might cause backward incompatibilities in some situations.

Additionally the following changes could be done:

  • Remove CommandSyntaxException from the throws clause of run
  • Remove CommandSyntaxException constructor without input and cursor parameter; 'real' syntax exceptions should have enough context to specify input and cursor values

This would require larger refactoring for dependent projects because they are currently throwing CommandSyntaxException inside run, and maybe there are edge cases where throwing CommandSyntaxException from run is reasonable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant