summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorRoss Burton <ross@linux.intel.com>2009-08-04 11:23:37 +0100
committerRoss Burton <ross@linux.intel.com>2009-08-04 11:26:59 +0100
commit7bb79fe2b706684e8719cc07498acb326eda074c (patch)
tree67496d37aaa830444985303c7e896ebc595f500b /examples
parente345c7af8ea7adf250fed88a8a61ed606cb79121 (diff)
downloadlibrest-7bb79fe2b706684e8719cc07498acb326eda074c.tar.gz
Use flickr_proxy_is_successful in the flickr example
Diffstat (limited to 'examples')
-rw-r--r--examples/get-flickr-favorites.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/examples/get-flickr-favorites.c b/examples/get-flickr-favorites.c
index 0cce1b0..6e6fe75 100644
--- a/examples/get-flickr-favorites.c
+++ b/examples/get-flickr-favorites.c
@@ -13,6 +13,7 @@ get_xml (RestProxyCall *call)
{
RestXmlParser *parser;
RestXmlNode *root;
+ GError *error = NULL;
parser = rest_xml_parser_new ();
@@ -20,20 +21,10 @@ get_xml (RestProxyCall *call)
rest_proxy_call_get_payload (call),
rest_proxy_call_get_payload_length (call));
- if (strcmp (root->name, "rsp") != 0) {
- g_error ("Unexpected response from Flickr:\n%s",
- rest_proxy_call_get_payload (call));
- }
-
- if (strcmp (rest_xml_node_get_attr (root, "stat"), "ok") != 0) {
- root = rest_xml_node_find (root, "err");
- g_error ("Error %s from Flickr: %s",
- rest_xml_node_get_attr (root, "code"),
- rest_xml_node_get_attr (root, "msg"));
- }
+ if (!flickr_proxy_is_successful (root, &error))
+ g_error (error->message);
g_object_unref (call);
-
g_object_unref (parser);
return root;