47 #ifndef _MIRA_JSONRPCRESPONSE_H_ 48 #define _MIRA_JSONRPCRESPONSE_H_ 75 auto it =
response.get_obj().find(
"error");
77 auto& obj = it->second;
78 auto messageit = obj.get_obj().find(
"message");
79 if(messageit==obj.get_obj().end()) {
80 MIRA_THROW(
XRPC,
"RPC client response has no correct error format: message missing");
82 auto stackit = obj.get_obj().find(
"callstack");
84 if(stackit==obj.get_obj().end())
87 auto threadit = obj.get_obj().find(
"thread");
88 if(threadit==obj.get_obj().end())
89 MIRA_THROW(
XRPC,
"RPC client response has no correct error format: callstack without thread id");
99 MIRA_THROW(
XRPC,
"RPC client response has no correct error format: callstack unreadable");
103 thread = threadit->second.get_uint64();
105 catch(std::runtime_error&) {
106 MIRA_THROW(
XRPC,
"RPC client response has no correct error format: thread id unreadable");
109 XRPC ex(messageit->second.get_str());
110 ex.addExternalStackInfo<
XRPC>(stack, thread);
113 auto excit = obj.get_obj().find(
"exception");
114 if(excit!=obj.get_obj().end()) {
119 ex.setOrigException(origEx);
127 it =
response.get_obj().find(
"result");
129 MIRA_THROW(
XRPC,
"RPC client response has no correct result format");
void deserialize(T &value)
Definition: JSONSerializer.h:427
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
Definition: IOService.h:67
Error codes for reasons of errors/exceptions while processing an rpc call.
uint32 ThreadID
Platform independent thread ID.
Definition: ThreadID.h:68
json::Value getResult() const
Return the result of the RPC call.
Definition: JSONRPCResponse.h:73
#define MIRA_THROW(ex, msg)
Macro for throwing an exception.
Definition: Exception.h:82
Wraps a JSON RPC call response.
Definition: JSONRPCResponse.h:61
Deserializer for serializing objects from JSON format.
Definition: JSONSerializer.h:400
An exception that is thrown by the RPCServer if an RPC call fails.
Definition: RPCError.h:76
json_spirit::mValue Value
A value is an abstract description of data in JSON (underlying data can either be one of the JSON bas...
Definition: JSON.h:176
JSONRPCResponse()
Definition: JSONRPCResponse.h:64
Encapsulates unix call stack functionality.
Definition: CallStack.h:86
json::Value response
The complete JSON RPC 2.0 response.
Definition: JSONRPCResponse.h:134
Definition: Exceptions.h:85
JSONRPCResponse(const json::Value &iResponse)
Definition: JSONRPCResponse.h:65