From 22e8e83ab95798288af01180bc9fe1a557ee2787 Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Fri, 7 May 2021 20:04:18 +0200 Subject: :bug: fix identify --- src/opcodes/instanceOf.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/opcodes/instanceOf.ts') diff --git a/src/opcodes/instanceOf.ts b/src/opcodes/instanceOf.ts index 4a34477f..7dcc95a2 100644 --- a/src/opcodes/instanceOf.ts +++ b/src/opcodes/instanceOf.ts @@ -4,11 +4,15 @@ import WebSocket from "../util/WebSocket"; export function check(this: WebSocket, schema: any, data: any) { try { - if (instanceOf(schema, data) !== true) throw "invalid"; + const error = instanceOf(schema, data); + if (error !== true) { + throw error; + } + return true; } catch (error) { console.error(error); // invalid payload this.close(CLOSECODES.Decode_error); - return false; + throw error; } } -- cgit 1.5.1