diff --git a/src/ts/@overflow/commons/websocket/protocol/ProtocolError.ts b/src/ts/@overflow/commons/websocket/protocol/ProtocolError.ts index ea0bf4e..c4ca8e3 100644 --- a/src/ts/@overflow/commons/websocket/protocol/ProtocolError.ts +++ b/src/ts/@overflow/commons/websocket/protocol/ProtocolError.ts @@ -42,6 +42,9 @@ export class ProtocolError { } public static convert(error: ProtocolError): ProtocolError { + if (undefined === error) { + return undefined; + } const code = error.code; if (undefined === code) { throw new Error(`Error must include Code`); diff --git a/src/ts/@overflow/commons/websocket/protocol/Response.ts b/src/ts/@overflow/commons/websocket/protocol/Response.ts index a162fcc..3981dcb 100644 --- a/src/ts/@overflow/commons/websocket/protocol/Response.ts +++ b/src/ts/@overflow/commons/websocket/protocol/Response.ts @@ -43,7 +43,9 @@ export class Response extends Header { let res = new Response(id); res.Protocol = response.protocol; res.result = response.result; - res.error = ProtocolError.convert(response.error); + if (undefined !== response.error) { + res.error = ProtocolError.convert(response.error); + } return res; }