buf fix
This commit is contained in:
parent
934652ea83
commit
c71d3541a6
|
@ -42,6 +42,9 @@ export class ProtocolError {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static convert(error: ProtocolError): ProtocolError {
|
public static convert(error: ProtocolError): ProtocolError {
|
||||||
|
if (undefined === error) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
const code = error.code;
|
const code = error.code;
|
||||||
if (undefined === code) {
|
if (undefined === code) {
|
||||||
throw new Error(`Error must include Code`);
|
throw new Error(`Error must include Code`);
|
||||||
|
|
|
@ -43,7 +43,9 @@ export class Response<ID> extends Header {
|
||||||
let res = new Response(id);
|
let res = new Response(id);
|
||||||
res.Protocol = response.protocol;
|
res.Protocol = response.protocol;
|
||||||
res.result = response.result;
|
res.result = response.result;
|
||||||
res.error = ProtocolError.convert(response.error);
|
if (undefined !== response.error) {
|
||||||
|
res.error = ProtocolError.convert(response.error);
|
||||||
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user