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

Exception messages updated to display aliases if any #162

Closed

Conversation

ngmarcus
Copy link

@ngmarcus ngmarcus commented Nov 6, 2020

Fixes #99

Fixed by catching and updating the exception message in the ExpenseBookParser before throwing out the same type of error with a new message. However, command string pattern used within the error messages themselves will also get replaced with this fix. Thus, invisible (non-printable) escape character ('\u200e') was injected for RemarkCommand.MESSAGE_USAGE and EditCommand.MESSAGE_NOT_EDITED to prevent replacement of the words "edit" and "remark" into their aliases within the error messages.

Illustration on escape character used:

  • "ran\u200edom" will display as "random" in the app
  • "ran\u200edom".equals("random") will evaluate to false

@ngmarcus ngmarcus added this to the v1.4 milestone Nov 6, 2020
@ngmarcus ngmarcus self-assigned this Nov 6, 2020
@maxxyh
Copy link

maxxyh commented Nov 7, 2020

How come it only applies to RemarkCommand and EditCommand?

@ngmarcus
Copy link
Author

ngmarcus commented Nov 8, 2020

Other command usage messages do not contain their respective COMMAND_WORD string pattern

@ngmarcus
Copy link
Author

ngmarcus commented Nov 8, 2020

Fix introduced is too hardcoded and not extensible.

@ngmarcus ngmarcus closed this Nov 8, 2020
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.

Alias Command does not update invalid command message
2 participants