2020-02-29 01:32:03 +00:00
|
|
|
#include "jsonrpc/impl/error.h"
|
2020-02-28 22:17:41 +00:00
|
|
|
|
|
|
|
json_t *
|
2020-02-29 01:32:03 +00:00
|
|
|
jsonrpc_impl_error(
|
2020-02-28 22:17:41 +00:00
|
|
|
int code,
|
|
|
|
char const * message)
|
|
|
|
{
|
|
|
|
json_t * error = json_object();
|
|
|
|
json_object_set_new(error, "code", json_integer(code));
|
|
|
|
json_object_set_new(error, "message", json_string(message));
|
|
|
|
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-02-29 01:32:03 +00:00
|
|
|
jsonrpc_impl_propate_error(
|
2020-02-28 22:17:41 +00:00
|
|
|
jsonrpc_proxy_finished_fn * finised,
|
|
|
|
void * user_data,
|
|
|
|
int code,
|
|
|
|
char const * message)
|
|
|
|
{
|
2020-02-29 01:32:03 +00:00
|
|
|
json_t * error = jsonrpc_impl_error(code, message);
|
2020-02-28 22:17:41 +00:00
|
|
|
finised(user_data, NULL, error);
|
|
|
|
|
|
|
|
json_decref(error);
|
|
|
|
}
|
|
|
|
|