This commit is contained in:
crusader 2017-08-16 13:56:13 +09:00
parent 934652ea83
commit c71d3541a6
2 changed files with 6 additions and 1 deletions

View File

@ -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`);

View File

@ -43,7 +43,9 @@ export class Response<ID> 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;
}