From 3d7db1a001e4a31610a2485e5a37810bfd081901 Mon Sep 17 00:00:00 2001 From: cha0s Date: Fri, 11 Dec 2020 12:09:58 -0600 Subject: [PATCH] fix: packets --- packages/governor/src/limited-packet.js | 2 +- packages/socket/src/index.js | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/governor/src/limited-packet.js b/packages/governor/src/limited-packet.js index 05071b4..985b5db 100644 --- a/packages/governor/src/limited-packet.js +++ b/packages/governor/src/limited-packet.js @@ -23,7 +23,7 @@ export default (latus, [name, Packet]) => class LimitedPacket extends Packet { throw error; } if (super.validate) { - super.validate(packet, socket); + await super.validate(packet, socket); } } diff --git a/packages/socket/src/index.js b/packages/socket/src/index.js index 2d99ad0..6ad5573 100644 --- a/packages/socket/src/index.js +++ b/packages/socket/src/index.js @@ -34,7 +34,12 @@ export default { return; } if (error instanceof Error) { - fn({code: 500, ...('production' === NODE_ENV ? {} : {stack: error.stack})}); + fn({ + code: error.code || 500, + reason: error.message, + ...('production' === NODE_ENV ? {} : {stack: error.stack}), + }); + return; } fn(error); }