-
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
Use/create a more intuitive errcode
#1269
Comments
This is a great first issue that would suit someone looking to get started helping build libp2p! To complete this:
|
Adds [CodeError](libp2p/js-libp2p#1269) to errors.ts Related: libp2p/js-libp2p-crypto#284 (comment) Added public to props and code to match AbortCode style. Also recently added the custom [Error.name](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/name) property to [code-err](https://github.com/tabcat/code-err) implementation. Co-authored-by: Alex Potsides <[email protected]>
Will look at completing this week now that CodeError is available. |
Replacing the imports is very easy. Here is some naive regex I'm using to replace the implementations for anyone looking to do this in their own projects. Works for most of the ways errCode is being used currently.
|
Have crossed out There is also an issue with replacing err-code with CodeError in the libp2p pr. It has to do with the supplied props being exposed by CodeError from error.props object instead of the error object directly. This could affect code relying on how err-code exposes the props, see more in the pr to the main libp2p repo in the list above. |
Replaces [err-code](https://github.com/IndigoUnited/js-err-code/blob/master/index.js) with [CodeError](libp2p/js-libp2p-interfaces#314) Related: [js-libp2p#1269](libp2p/js-libp2p#1269) Changes - removes err-code from dependencies - adds @libp2p/[email protected] to dependencies - uses CodeError in place of err-code
Replaces [err-code](https://github.com/IndigoUnited/js-err-code/blob/master/index.js) with [CodeError](libp2p/js-libp2p-interfaces#314) Related: [js-libp2p#1269](libp2p/js-libp2p#1269) Changes - removes err-code from dependencies - adds @libp2p/[email protected] to dependencies - uses CodeError in place of err-code
Replaces [err-code](https://github.com/IndigoUnited/js-err-code/blob/master/index.js) with [CodeError](libp2p/js-libp2p-interfaces#314) Related: [js-libp2p#1269](libp2p/js-libp2p#1269) Changes - removes err-code from dependencies - adds @libp2p/[email protected] to dependencies - uses CodeError in place of err-code
Replaces [err-code](https://github.com/IndigoUnited/js-err-code/blob/master/index.js) with [CodeError](libp2p/js-libp2p-interfaces#314) Related: [#1269](libp2p/js-libp2p#1269) Changes (only affect peer-id package) - added @libp2p/[email protected] to the to use the new CodeError export - removes err-code from dependencies - uses CodeError in place of err-code
Replaces [err-code](https://github.com/IndigoUnited/js-err-code/blob/master/index.js) with [CodeError](libp2p/js-libp2p-interfaces#314) Related: [js-libp2p#1269](libp2p/js-libp2p#1269) Changes - removes err-code from dependencies - adds @libp2p/[email protected] to dependencies - uses CodeError in place of err-code
Replaces [err-code](https://github.com/IndigoUnited/js-err-code/blob/master/index.js) with [CodeError](libp2p/js-libp2p-interfaces#314) Related: [js-libp2p#1269](libp2p/js-libp2p#1269) Changes - removes err-code from dependencies - adds @libp2p/[email protected] to dependencies - uses CodeError in place of err-code
Replaces [err-code](https://github.com/IndigoUnited/js-err-code/blob/master/index.js) with [CodeError](libp2p/js-libp2p-interfaces#314) Related: [js-libp2p#1269](libp2p/js-libp2p#1269) Changes - removes err-code from dependencies - adds @libp2p/[email protected] to dependencies - uses CodeError in place of err-code
Replaces [err-code](https://github.com/IndigoUnited/js-err-code/blob/master/index.js) with [CodeError](libp2p/js-libp2p-interfaces#314) Related: [js-libp2p#1269](libp2p/js-libp2p#1269) Changes - removes err-code from dependencies - adds @libp2p/[email protected] to dependencies - uses CodeError in place of err-code
Replaces [err-code](https://github.com/IndigoUnited/js-err-code/blob/master/index.js) with [CodeError](libp2p/js-libp2p-interfaces#314) Related: [js-libp2p#1269](libp2p/js-libp2p#1269) Changes - removes err-code from dependencies - adds @libp2p/[email protected] to dependencies - uses CodeError in place of err-code
Replaces [err-code](https://github.com/IndigoUnited/js-err-code/blob/master/index.js) with [CodeError](libp2p/js-libp2p-interfaces#314) Related: [js-libp2p#1269](libp2p/js-libp2p#1269) Changes - removes err-code from dependencies - adds @libp2p/[email protected] to dependencies - uses CodeError in place of err-code
Replaces [err-code](https://github.com/IndigoUnited/js-err-code/blob/master/index.js) with [CodeError](libp2p#314) Related: [js-libp2p#1269](libp2p/js-libp2p#1269) Changes - removes err-code from dependencies - adds @libp2p/[email protected] to dependencies - uses CodeError in place of err-code
@tabcat looks like all but a few prs remain for this effort. Need some help shepherding those along? Another module that we likely need this change in is https://github.com/libp2p/js-libp2p-webtransport |
I meant to update this thread. libp2p/js-libp2p-interfaces#334 needs attention. I'm not sure how to bump the #1532 just needs the proper breaking change notice to be added by me
I'll add it to the list |
Replaces [err-code](https://github.com/IndigoUnited/js-err-code/blob/master/index.js) with [CodeError](libp2p#314) Related: [js-libp2p#1269](libp2p/js-libp2p#1269) Changes - removes err-code from dependencies - adds @libp2p/[email protected] to dependencies - uses CodeError in place of err-code
Replaces [err-code](https://github.com/IndigoUnited/js-err-code/blob/master/index.js) with [CodeError](libp2p#314) Related: [js-libp2p#1269](libp2p/js-libp2p#1269) Changes - removes err-code from dependencies - adds @libp2p/[email protected] to dependencies - uses CodeError in place of err-code
* chore: replace err-code with CodeError Replaces [err-code](https://github.com/IndigoUnited/js-err-code/blob/master/index.js) with [CodeError](#314) Related: [js-libp2p#1269](libp2p/js-libp2p#1269) Changes - removes err-code from dependencies - adds @libp2p/[email protected] to dependencies - uses CodeError in place of err-code * remove err-code dep --------- Co-authored-by: Marin Petrunic <[email protected]>
## [@libp2p/interface-mocks-v9.1.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v9.1.1...@libp2p/interface-mocks-v9.1.2) (2023-02-22) ### Bug Fixes * replace err-code with CodeError ([#334](#334)) ([a909d41](a909d41)), closes [js-libp2p#1269](libp2p/js-libp2p#1269)
## [6.0.1](v6.0.0...v6.0.1) (2023-02-28) ### Trivial Changes * replace err-code with CodeError ([#53](#53)) ([e6b87d7](e6b87d7)), closes [js-libp2p#1269](libp2p/js-libp2p#1269) * Update .github/workflows/semantic-pull-request.yml [skip ci] ([1139dc4](1139dc4)) ### Documentation * Update API link ([#65](#65)) ([1b75110](1b75110)), closes [#64](#64)
Adding js-libp2p-keychain to the todo list |
It looks like |
## [7.0.1](v7.0.0...v7.0.1) (2023-03-10) ### Bug Fixes * correct `KBucketTree` types ([#426](#426)) ([ea8e6d0](ea8e6d0)), closes [/github.com/tristanls/k-bucket/blob/3aa5b4f1dacb835752995a25409ab319d2070b9e/index.js#L413](https://github.com/libp2p//github.com/tristanls/k-bucket/blob/3aa5b4f1dacb835752995a25409ab319d2070b9e/index.js/issues/L413) * update p-queue types ([#428](#428)) ([f5b85fc](f5b85fc)) ### Trivial Changes * replace err-code with CodeError ([#413](#413)) ([e05d2a0](e05d2a0)), closes [js-libp2p#1269](libp2p/js-libp2p#1269) * Update .github/workflows/semantic-pull-request.yml [skip ci] ([a70ab3f](a70ab3f)) * Update .github/workflows/semantic-pull-request.yml [skip ci] ([1652c6c](1652c6c)) * Update .github/workflows/semantic-pull-request.yml [skip ci] ([ea13c2a](ea13c2a))
## [5.0.1](v5.0.0...v5.0.1) (2023-03-10) ### Trivial Changes * replace err-code with CodeError ([#42](#42)) ([b76d07f](b76d07f)), closes [js-libp2p#1269](libp2p/js-libp2p#1269) * Update .github/workflows/semantic-pull-request.yml [skip ci] ([157d49d](157d49d)) * Update .github/workflows/semantic-pull-request.yml [skip ci] ([920dfd3](920dfd3)) * Update .github/workflows/semantic-pull-request.yml [skip ci] ([1ef05ef](1ef05ef)) * upgrade `aegir` to `38.1.2` ([#48](#48)) ([e0fd5e3](e0fd5e3)) ### Dependencies * bump protons-runtime from 4.0.2 to 5.0.0 ([#45](#45)) ([83958a5](83958a5))
## [3.0.1](v3.0.0...v3.0.1) (2023-03-10) ### Trivial Changes * replace err-code with CodeError ([#71](#71)) ([a843ae4](a843ae4)), closes [js-libp2p#1269](libp2p/js-libp2p#1269) * Update .github/workflows/semantic-pull-request.yml [skip ci] ([3982918](3982918)) * Update .github/workflows/semantic-pull-request.yml [skip ci] ([79984c0](79984c0)) * Update .github/workflows/semantic-pull-request.yml [skip ci] ([7ccccc7](7ccccc7)) ### Dependencies * **dev:** bump aegir from 37.12.1 to 38.1.7 ([#84](#84)) ([4cc5935](4cc5935))
replace err-code with CodeError from @libp2p/interfaces Related: libp2p/js-libp2p#1269
## [3.0.5](v3.0.4...v3.0.5) (2023-03-17) ### Trivial Changes * replace err-code with CodeError ([#70](#70)) ([beb252d](beb252d)), closes [js-libp2p#1269](libp2p/js-libp2p#1269) * Update .github/workflows/semantic-pull-request.yml [skip ci] ([acad1fe](acad1fe)) * Update .github/workflows/semantic-pull-request.yml [skip ci] ([1b96837](1b96837)) * Update .github/workflows/semantic-pull-request.yml [skip ci] ([10d6e7a](10d6e7a)) ### Dependencies * bump @multiformats/multiaddr from 11.6.1 to 12.0.0 ([#83](#83)) ([3eeeeba](3eeeeba)) * **dev:** bump aegir from 37.12.1 to 38.1.7 ([#80](#80)) ([2c262ba](2c262ba))
Replaces [err-code](https://github.com/IndigoUnited/js-err-code/blob/master/index.js) with [CodeError](libp2p/js-libp2p-interfaces#314) Related: #1269 Changes - removes err-code from dependencies - adds @libp2p/[email protected] to dependencies - uses CodeError in place of err-code --------- Co-authored-by: achingbrain <[email protected]>
Do you think this can be closed now? @wemeetagain |
Thanks for all the great work @tabcat! There are some deps which were missing from the list, I updated the comment to include them as well as to highlight why some repos were unaffected. Almost there! |
## [7.1.2](v7.1.1...v7.1.2) (2023-03-21) ### Trivial Changes * replace err-code with CodeError ([#242](#242)) ([8d58a3b](8d58a3b)), closes [js-libp2p#1269](libp2p/js-libp2p#1269) * Update .github/workflows/semantic-pull-request.yml [skip ci] ([54de88d](54de88d)) * Update .github/workflows/semantic-pull-request.yml [skip ci] ([df03e8d](df03e8d)) * Update .github/workflows/semantic-pull-request.yml [skip ci] ([9c3f235](9c3f235)) ### Dependencies * **dev:** bump typescript from 4.9.5 to 5.0.2 ([#256](#256)) ([a3590af](a3590af)) * **dev:** Upgrade aegir to 38.1.7 ([#257](#257)) ([e0bf45a](e0bf45a))
## [3.1.3](v3.1.2...v3.1.3) (2023-03-31) ### Trivial Changes * replace err-code with CodeError ([#36](#36)) ([fc2aefd](fc2aefd)), closes [js-libp2p#1269](libp2p/js-libp2p#1269) * Update .github/workflows/semantic-pull-request.yml [skip ci] ([1861a94](1861a94)) * Update .github/workflows/semantic-pull-request.yml [skip ci] ([0f312c0](0f312c0)) * Update .github/workflows/semantic-pull-request.yml [skip ci] ([6a277a6](6a277a6)) ### Dependencies * bump it-merge from 2.0.1 to 3.0.0 ([#51](#51)) ([129166b](129166b)) * **dev:** bump it-all from 2.0.1 to 3.0.1 ([#50](#50)) ([d8420a0](d8420a0))
Related: libp2p/js-libp2p#1269 - deps: install @libp2p/interfaces - fix: replace err-code with CodeError - deps: remove err-code
@tabcat thank you for driving this! It's been shipped so we'll close this. |
## [@libp2p/peer-id-v2.0.1](https://github.com/libp2p/js-libp2p-peer-id/compare/@libp2p/peer-id-v2.0.0...@libp2p/peer-id-v2.0.1) (2023-01-18) ### Trivial Changes * replace err-code with CodeError ([libp2p#45](libp2p/js-libp2p-peer-id#45)) ([06e39f0](libp2p/js-libp2p-peer-id@06e39f0)), closes [libp2p#1269](https://github.com/libp2p/js-libp2p-peer-id/issues/1269) ### Dependencies * bump aegir from 37.12.1 to 38.1.0 ([libp2p#46](libp2p/js-libp2p-peer-id#46)) ([ba54f6a](libp2p/js-libp2p-peer-id@ba54f6a))
Current usage of errcode is not intuitive.
example:
Prefer an implementation like:
with usage then like:
The text was updated successfully, but these errors were encountered: