-
Notifications
You must be signed in to change notification settings - Fork 445
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: replace err-code with CodeError #1532
Conversation
Two options to handle the .props breaking change wrt err-code -> CodeError
|
we'll want to go with this option:
|
Ill start looking for those cases then in ipfs/libp2p and other related dependents |
From what I could find from the dependents on npm, this doesnt seem to be used internally. It is documented in the code as an API. Will need to update that. |
6a62f0b
to
2393be2
Compare
src/keychain/cms.ts
Outdated
throw errCode(new Error(`Decryption needs one of the key(s): ${missingKeys.join(', ')}`), codes.ERR_MISSING_KEYS, { | ||
throw new CodeError(`Decryption needs one of the key(s): ${missingKeys.join(', ')}`, codes.ERR_MISSING_KEYS, { | ||
missingKeys | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only piece of code affected by the props
change in CodeError across all of the libp2p packages.
src/keychain/cms.ts
Outdated
* exists, an Error is returned with the property 'missingKeys'. It is array of key ids. | ||
* exists, an Error is returned with the property '.props.missingKeys'. It is array of key ids. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me know if this needs to be reworded.
chore: upgrade @libp2p/interfaces to v3.2.0 chore: remove err-code from deps replace errCode imports with CodeError replace errCode implementations with CodeError
Since the keychain has been moved to it's own repo this is no longer a breaking change. |
Thanks for opening this and having such patience. We got there! |
Replaces err-code with CodeError
Related: #1269
Changes
BlockersDecide how to handle .props breaking changeerr-code exposes properties inside its props parameter directly from the error object (e.g. error.someProp). CodeError exposes them from the provided props parameter (e.g. error.props.someProp) (see: js-libp2p/crypto#278 CodeError behavior vs. errcode).https://github.com/libp2p/js-libp2p/pull/1532/files#diff-f7c06d53ddde550172379d5951eb28536d95404fa767ee9d986a8fdae34ddd56L127-L130