diff --git a/package.json b/package.json index b1f2461..86bd5ed 100644 --- a/package.json +++ b/package.json @@ -182,14 +182,13 @@ "@libp2p/interface-peer-id": "^2.0.0", "@libp2p/interface-pubsub": "^3.0.0", "@libp2p/interface-registrar": "^2.0.0", - "@libp2p/interfaces": "^3.0.2", + "@libp2p/interfaces": "^3.2.0", "@libp2p/logger": "^2.0.0", "@libp2p/peer-collections": "^3.0.0", "@libp2p/peer-id": "^2.0.0", "@libp2p/topology": "^4.0.0", "@multiformats/multiaddr": "^11.0.0", "abortable-iterator": "^4.0.2", - "err-code": "^3.0.1", "it-length-prefixed": "^8.0.2", "it-pipe": "^2.0.3", "it-pushable": "^3.0.0", diff --git a/src/index.ts b/src/index.ts index e73509f..b0648a0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,6 @@ import { logger } from '@libp2p/logger' import { EventEmitter, CustomEvent } from '@libp2p/interfaces/events' -import errcode from 'err-code' +import { CodeError } from '@libp2p/interfaces/errors' import { pipe } from 'it-pipe' import Queue from 'p-queue' import { createTopology } from '@libp2p/topology' @@ -447,22 +447,22 @@ export abstract class PubSubBaseProtocol (maybeArray: T | T[]) { export const toMessage = (message: PubSubRPCMessage): Message => { if (message.from == null) { - throw errcode(new Error('RPC message was missing from'), codes.ERR_MISSING_FROM) + throw new CodeError('RPC message was missing from', codes.ERR_MISSING_FROM) } if (message.sequenceNumber == null || message.from == null || message.signature == null || message.key == null) {