Add response error handling to the HTTP API

This commit is contained in:
2015-12-15 12:25:45 +01:00
parent 9552136059
commit 2dbc3ea316
3 changed files with 49 additions and 4 deletions

View File

@@ -31,10 +31,19 @@ static GOptionEntry entries[] = {
};
static void
login_finished(MatrixAPI *api, JsonNode *content, gpointer data, GError **err)
login_finished(MatrixAPI *api, JsonNode *content, gpointer data, GError *err)
{
JsonPath *path = json_path_new();
JsonNode *result;
GMainLoop *loop = data;
if (err) {
g_printf("ERROR: %s\n", err->message);
g_main_loop_quit(loop);
return;
}
json_path_compile(path, "$.user_id", NULL);
@@ -92,7 +101,7 @@ main(int argc, char *argv[])
"password", password,
NULL);
matrix_http_api_login(MATRIX_API(api),
login_finished, NULL,
login_finished, loop,
"m.login.password",
params);