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

fix(Args): ensure proper error types are always thrown #601

Merged
merged 1 commit into from
Feb 5, 2023

Conversation

favna
Copy link
Member

@favna favna commented Feb 5, 2023

This changes the result.unwrap() calls to result.unwrapRaw() to ensure that the erorr that gets thrown for the following methods:

  • args.pick(...)
  • args.rest(...)
  • args.repeat(...)
  • args.peek(...) This makes it so that the error that ends up in messageCommandError listener will have the proper error type. Furthermore, it can also be handled properly when chaining .catch() calls to the args.X method.

resolves #528


Reproduced the error first with https://github.com/favna/musical-giggle, then confirmed the fix using a debugger with the code from the issue. Also confirmed that it is resolved for Args.make by copying the code from https://github.com/favna/repro-sapphire-unwrap-error which was created for a separately reported issue.

This changes the `result.unwrap()` calls to `result.unwrapRaw()` to
ensure that the erorr that gets thrown for the following methods:
- `args.pick(...)`
- `args.rest(...)`
- `args.repeat(...)`
- `args.peek(...)`
This makes it so that the error that ends up in `messageCommandError`
listener will have the proper error type. Furthermore, it can also
be handled properly when chaining `.catch()` calls to the `args.X` method.

resolves #528
@favna favna merged commit ee8be2e into main Feb 5, 2023
@favna favna deleted the fix/fixed-args-unwrapping branch February 5, 2023 22:57
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.

bug: missing required args causes an "unwrap failed" error
2 participants