Update jsonrpc2.js

This commit is contained in:
Namhyeon Go 2024-04-07 15:53:55 +09:00
parent e332682fd2
commit 6537f9a635

View File

@ -41,7 +41,8 @@ function JsonRpcObject() {
} }
this.call = function(method, params, id) { this.call = function(method, params, id) {
var data = HTTP.create("MSXML") var result;
var response = HTTP.create("MSXML")
.setContentType("application/json") .setContentType("application/json")
.setDataType("json") .setDataType("json")
.setRequestBody(encode(method, params, id)) .setRequestBody(encode(method, params, id))
@ -50,7 +51,16 @@ function JsonRpcObject() {
.responseBody .responseBody
; ;
return data; if ("error" in response) {
console.error(response.error.message);
return;
}
if ("result" in response) {
result = response.result;
}
return result;
} }
} }