2020-06-16 21:39:45 +00:00
|
|
|
#include "webfuse_provider/impl/jsonrpc/error.h"
|
2020-02-28 22:17:41 +00:00
|
|
|
|
2020-07-11 22:39:55 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
struct wfp_jsonrpc_error *
|
|
|
|
wfp_jsonrpc_error_create(
|
2020-02-28 22:17:41 +00:00
|
|
|
int code,
|
|
|
|
char const * message)
|
|
|
|
{
|
2020-07-11 22:39:55 +00:00
|
|
|
struct wfp_jsonrpc_error * error = malloc(sizeof(struct wfp_jsonrpc_error));
|
|
|
|
error->code = code;
|
|
|
|
error->message = strdup(message);
|
2020-02-28 22:17:41 +00:00
|
|
|
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
2020-07-11 22:39:55 +00:00
|
|
|
void
|
|
|
|
wfp_jsonrpc_error_dispose(
|
|
|
|
struct wfp_jsonrpc_error * error)
|
|
|
|
{
|
|
|
|
free(error->message);
|
|
|
|
free(error);
|
|
|
|
}
|
|
|
|
|
2020-02-28 22:17:41 +00:00
|
|
|
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-07-11 22:39:55 +00:00
|
|
|
struct wfp_jsonrpc_error error;
|
|
|
|
error.code = code;
|
|
|
|
error.message = (char*) message;
|
2020-02-28 22:17:41 +00:00
|
|
|
|
2020-07-11 22:39:55 +00:00
|
|
|
finised(user_data, NULL, &error);
|
2020-02-28 22:17:41 +00:00
|
|
|
}
|
|
|
|
|