diff --git a/src/ts/@overflow/commons/websocket/WebSocketRPC.ts b/src/ts/@overflow/commons/websocket/WebSocketRPC.ts index 110162a..354fef8 100644 --- a/src/ts/@overflow/commons/websocket/WebSocketRPC.ts +++ b/src/ts/@overflow/commons/websocket/WebSocketRPC.ts @@ -146,12 +146,30 @@ export default class WebSocketRPC { console.log(result); promise.resolve(result); } else if (null != error) { - if (ErrorCode.E_RUNTIME === error.Code) { - const returnError: Error = { - name: error.Message, - message: null, - }; - promise.reject(returnError); + if (ErrorCode.E_INTERNAL === error.Code) { + if (undefined !== error.Message) { + const msgs = error.Message.split('|'); + let errorName: string; + let errorMessage: string; + switch (msgs.length) { + case 1: + errorName = msgs[0]; + break; + case 2: + errorName = msgs[0]; + errorMessage = msgs[1]; + break; + default: + break; + } + const returnError: Error = { + name: errorName, + message: errorMessage, + }; + promise.reject(returnError); + } else { + console.log(`System error[${error.Message}]`); + } } else { console.log(`System error[${error.Code}|${error.Message}|${error.Data}]`); }