Fix RPC server to include exception message

This commit is contained in:
blagoev 2017-10-02 11:15:28 +03:00
parent aaabc1e286
commit b8fc18e7e9
2 changed files with 5 additions and 2 deletions

View File

@ -248,6 +248,10 @@ function sendRequest(command, data, host = sessionHost) {
}
else if (error.type && error.type == 'dict') {
let responseError = deserialize_json_value(error);
if (response.message && response.message !== '') {
responseError.message = response.message;
}
throw responseError;
}

View File

@ -371,8 +371,7 @@ json RPCServer::perform_request(std::string name, const json &args) {
catch (...) {
exceptionAsJson = {{"error", "An exception occured while processing the request. Could not serialize the exception as JSON"}};
}
return (json){{"error", exceptionAsJson}};
return (json){{"error", exceptionAsJson}, {"message", ex.what()}};
}
catch (std::exception &exception) {
return (json){{"error", exception.what()}};