@@ -5,7 +5,7 @@ import * as Digest from 'multiformats/hashes/digest'
5
5
import { identity } from 'multiformats/hashes/identity'
6
6
import { equals as uint8ArrayEquals } from 'uint8arrays/equals'
7
7
import { sha256 } from 'multiformats/hashes/sha2'
8
- import errcode from 'err-code '
8
+ import { CodeError } from '@libp2p/interfaces/errors '
9
9
import { Ed25519PeerId , PeerIdType , RSAPeerId , Secp256k1PeerId , symbol } from '@libp2p/interface-peer-id'
10
10
import type { MultibaseDecoder } from 'multiformats/bases/interface'
11
11
import type { MultihashDigest } from 'multiformats/hashes/interface'
@@ -177,7 +177,7 @@ export function createPeerId (init: PeerIdInit): PeerId {
177
177
return new Secp256k1PeerIdImpl ( init )
178
178
}
179
179
180
- throw errcode ( new Error ( 'Type must be "RSA", "Ed25519" or "secp256k1"' ) , 'ERR_INVALID_PARAMETERS' )
180
+ throw new CodeError ( 'Type must be "RSA", "Ed25519" or "secp256k1"' , 'ERR_INVALID_PARAMETERS' )
181
181
}
182
182
183
183
export function peerIdFromPeerId ( other : any ) : PeerId {
@@ -193,7 +193,7 @@ export function peerIdFromPeerId (other: any): PeerId {
193
193
return new Secp256k1PeerIdImpl ( other )
194
194
}
195
195
196
- throw errcode ( new Error ( 'Not a PeerId' ) , 'ERR_INVALID_PARAMETERS' )
196
+ throw new CodeError ( 'Not a PeerId' , 'ERR_INVALID_PARAMETERS' )
197
197
}
198
198
199
199
export function peerIdFromString ( str : string , decoder ?: MultibaseDecoder < any > ) : PeerId {
0 commit comments