2020-06-16 21:39:45 +00:00
|
|
|
#include "webfuse_provider/impl/jsonrpc/error.h"
|
2020-02-28 22:17:41 +00:00
|
|
|
|
|
|
|
json_t *
|
2020-06-16 21:57:41 +00:00
|
|
|
wfp_jsonrpc_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-06-16 21:57:41 +00:00
|
|
|
wfp_jsonrpc_propate_error(
|
|
|
|
wfp_jsonrpc_proxy_finished_fn * finised,
|
2020-02-28 22:17:41 +00:00
|
|
|
void * user_data,
|
|
|
|
int code,
|
|
|
|
char const * message)
|
|
|
|
{
|
2020-06-16 21:57:41 +00:00
|
|
|
json_t * error = wfp_jsonrpc_error(code, message);
|
2020-02-28 22:17:41 +00:00
|
|
|
finised(user_data, NULL, error);
|
|
|
|
|
|
|
|
json_decref(error);
|
|
|
|
}
|
|
|
|
|