[grilo-plugins] lua-factory: Print URL for failed fetches
- From: Juan A. Suarez Romero <jasuarez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins] lua-factory: Print URL for failed fetches
- Date: Mon, 17 Mar 2014 23:01:16 +0000 (UTC)
commit 19a8dafc554d1c67c19adf41ed1135af560ab936
Author: Bastien Nocera <hadess hadess net>
Date: Mon Mar 17 16:50:32 2014 +0100
lua-factory: Print URL for failed fetches
When a network fetch fails, show the URL of the fail call, so
that the lua script can be fixed/debugged.
https://bugzilla.gnome.org/show_bug.cgi?id=726562
src/lua-factory/grl-lua-library.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/src/lua-factory/grl-lua-library.c b/src/lua-factory/grl-lua-library.c
index 7ba9d13..5abf50e 100644
--- a/src/lua-factory/grl-lua-library.c
+++ b/src/lua-factory/grl-lua-library.c
@@ -36,6 +36,7 @@ typedef struct _FetchOperation {
lua_State *L;
gchar *lua_cb;
guint index;
+ gchar *url;
guint num_urls;
gboolean is_table;
gchar **results;
@@ -309,7 +310,7 @@ grl_util_fetch_done (GObject *source_object,
fo->results[fo->index] = (err == NULL) ? g_strdup (data) : g_strdup ("");
if (err != NULL) {
- GRL_WARNING ("Can't fetch element %d: '%s'", fo->index + 1, err->message);
+ GRL_WARNING ("Can't fetch element %d (URL: %s): '%s'", fo->index + 1, fo->url, err->message);
g_error_free (err);
} else {
GRL_DEBUG ("fetch_done element %d of %d urls", fo->index + 1, fo->num_urls);
@@ -346,6 +347,7 @@ grl_util_fetch_done (GObject *source_object,
for (i = 0; i < fo->num_urls; i++)
g_free (fo->results[i]);
+ g_free (fo->url);
g_free (fo->results);
g_free (fo->lua_cb);
g_free (fo);
@@ -660,6 +662,7 @@ grl_l_fetch (lua_State *L)
fo->L = L;
fo->lua_cb = g_strdup (lua_callback);
fo->index = i;
+ fo->url = g_strdup (urls[i]);
fo->num_urls = num_urls;
fo->is_table = is_table;
fo->results = results;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]