Skip to content

Commit b76d07f

Browse files
authored
chore: replace err-code with CodeError (libp2p#42)
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#1269) Changes - removes err-code from dependencies - adds @libp2p/interfaces@3.2.0 to dependencies - uses CodeError in place of err-code
1 parent 8ffc147 commit b76d07f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,11 @@
149149
"@libp2p/crypto": "^1.0.11",
150150
"@libp2p/interface-peer-id": "^2.0.0",
151151
"@libp2p/interface-record": "^2.0.1",
152+
"@libp2p/interfaces": "^3.2.0",
152153
"@libp2p/logger": "^2.0.5",
153154
"@libp2p/peer-id": "^2.0.0",
154155
"@libp2p/utils": "^3.0.0",
155156
"@multiformats/multiaddr": "^11.0.0",
156-
"err-code": "^3.0.1",
157157
"interface-datastore": "^7.0.0",
158158
"it-all": "^2.0.0",
159159
"it-filter": "^2.0.0",

src/envelope/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import errCode from 'err-code'
1+
import { CodeError } from '@libp2p/interfaces/errors'
22
import { fromString as uint8arraysFromString } from 'uint8arrays/from-string'
33
import { equals as uint8ArrayEquals } from 'uint8arrays/equals'
44
import { unmarshalPrivateKey, unmarshalPublicKey } from '@libp2p/crypto/keys'
@@ -66,7 +66,7 @@ export class RecordEnvelope implements Envelope {
6666
const valid = await envelope.validate(domain)
6767

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

7272
return envelope

0 commit comments

Comments
 (0)