Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

Commit

Permalink
refactor: replace err-code with CodeError
Browse files Browse the repository at this point in the history
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/interfaces@3.2.0 to dependencies
- uses CodeError in place of err-code
  • Loading branch information
tabcat committed Jan 9, 2023
1 parent 8ffc147 commit 8e7de45
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,11 @@
"@libp2p/crypto": "^1.0.11",
"@libp2p/interface-peer-id": "^2.0.0",
"@libp2p/interface-record": "^2.0.1",
"@libp2p/interfaces": "^3.2.0",
"@libp2p/logger": "^2.0.5",
"@libp2p/peer-id": "^2.0.0",
"@libp2p/utils": "^3.0.0",
"@multiformats/multiaddr": "^11.0.0",
"err-code": "^3.0.1",
"interface-datastore": "^7.0.0",
"it-all": "^2.0.0",
"it-filter": "^2.0.0",
Expand Down
4 changes: 2 additions & 2 deletions src/envelope/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import errCode from 'err-code'
import { CodeError } from '@libp2p/interfaces/errors'
import { fromString as uint8arraysFromString } from 'uint8arrays/from-string'
import { equals as uint8ArrayEquals } from 'uint8arrays/equals'
import { unmarshalPrivateKey, unmarshalPublicKey } from '@libp2p/crypto/keys'
Expand Down Expand Up @@ -66,7 +66,7 @@ export class RecordEnvelope implements Envelope {
const valid = await envelope.validate(domain)

if (!valid) {
throw errCode(new Error('envelope signature is not valid for the given domain'), codes.ERR_SIGNATURE_NOT_VALID)
throw new CodeError('envelope signature is not valid for the given domain', codes.ERR_SIGNATURE_NOT_VALID)
}

return envelope
Expand Down

0 comments on commit 8e7de45

Please sign in to comment.