From f713bd23247adb11a2e90a9c9ff40031e5095539 Mon Sep 17 00:00:00 2001 From: tabcat Date: Tue, 21 Mar 2023 13:04:55 -0500 Subject: [PATCH 1/3] deps: install @libp2p/interfaces --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 89acdec..e1cd4d2 100644 --- a/package.json +++ b/package.json @@ -139,6 +139,7 @@ }, "dependencies": { "@achingbrain/ssdp": "^4.0.1", + "@libp2p/interfaces": "^3.3.1", "@libp2p/logger": "^2.0.0", "default-gateway": "^6.0.2", "err-code": "^3.0.1", From 0c19f24b73201f90a515309aff386f2ccd6601cf Mon Sep 17 00:00:00 2001 From: tabcat Date: Tue, 21 Mar 2023 13:31:32 -0500 Subject: [PATCH 2/3] fix: replace err-code with CodeError --- src/pmp/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pmp/index.ts b/src/pmp/index.ts index 89545b6..4ee46fb 100644 --- a/src/pmp/index.ts +++ b/src/pmp/index.ts @@ -1,7 +1,7 @@ import { createSocket } from 'dgram' import { logger } from '@libp2p/logger' import { EventEmitter } from 'events' -import errCode from 'err-code' +import { CodeError } from '@libp2p/interfaces/errors' import defer, { DeferredPromise } from 'p-defer' import type { Socket, RemoteInfo } from 'dgram' import type { Client, MapPortOptions, UnmapPortOptions } from '../index.js' @@ -341,7 +341,7 @@ export class PMPClient extends EventEmitter implements Client { // Error if (parsed.resultCode !== 0) { - return cb(errCode(new Error(parsed.resultMessage), parsed.resultCode)) + return cb(new CodeError(parsed.resultMessage, parsed.resultCode)) } // Success From 7ff6fbdae36cfeab8f29cde42719fc6799d5077a Mon Sep 17 00:00:00 2001 From: tabcat Date: Tue, 21 Mar 2023 13:31:49 -0500 Subject: [PATCH 3/3] deps: remove err-code --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index e1cd4d2..68073d6 100644 --- a/package.json +++ b/package.json @@ -142,7 +142,6 @@ "@libp2p/interfaces": "^3.3.1", "@libp2p/logger": "^2.0.0", "default-gateway": "^6.0.2", - "err-code": "^3.0.1", "it-first": "^1.0.7", "p-defer": "^4.0.0", "p-timeout": "^5.0.2",