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

Should we create custom errors instead of relying on the base error class? #1231

Open
fuxingloh opened this issue Mar 17, 2022 · 2 comments
Open
Labels
area/packages kind/feature New feature request needs/triage Waiting for triage to be accepted

Comments

@fuxingloh
Copy link
Contributor

It's out of the scope of this PR, but should we create custom errors instead of relying on the base error class? Something like

class MnemonicValidationError extends Error {
    message = "mnemonic sentence checksum invalid"
}

so we can use it in later error handling with something like:

try {
 // ... do something ...
}catch(err){
    if(err instanceof MnemonicValidationError){
        //  handle it somehow
    }
}
expect(() => {
        MnemonicHdNodeProvider.fromWords(words, regTestBip32Options, false)
      }).not.toThrow(MnemonicValidationError)

This is probably something that needs discussion from the team and is more of a change in convention than something related to this PR.

Originally posted by @cwkang1998 in #1225 (comment)

/kind feature
/area packages

@defichain-bot defichain-bot added the needs/triage Waiting for triage to be accepted label Mar 17, 2022
@defichain-bot
Copy link
Member

@fuxingloh: Thanks for opening an issue, it is currently awaiting triage.

The triage/accepted label can be added by foundation members by writing /triage accepted in a comment.

Details

I am a bot created to help the DeFiCh developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the DeFiCh/oss-governance-bot repository.

@canonbrother canonbrother self-assigned this Mar 18, 2022
@fuxingloh
Copy link
Contributor Author

fuxingloh commented Mar 21, 2022

Btw this is very low priority

@canonbrother canonbrother removed their assignment Mar 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/packages kind/feature New feature request needs/triage Waiting for triage to be accepted
Projects
None yet
Development

No branches or pull requests

3 participants