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

Avoid eager stringification of exception messages #125

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

intsuc
Copy link

@intsuc intsuc commented Feb 3, 2023

This PR avoids stringifying exception messages eagerly to reduce the overhead on command failure.

@intsuc intsuc marked this pull request as ready for review February 3, 2023 09:34
@@ -16,15 +16,15 @@ public class CommandSyntaxException extends Exception {
private final int cursor;

public CommandSyntaxException(final CommandExceptionType type, final Message message) {
super(message.getString(), null, ENABLE_COMMAND_STACK_TRACES, ENABLE_COMMAND_STACK_TRACES);
super(null, null, ENABLE_COMMAND_STACK_TRACES, ENABLE_COMMAND_STACK_TRACES);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the 2nd null, could you delete it because its a duplicate? Same for line 27?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The second null should not be a duplicate. Since Exception does not have such a constructor, if you delete the second null, it will result in an error.

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

Successfully merging this pull request may close these issues.

2 participants