[libgdata] [core] Use the error reason phrase if the response body is empty



commit f357ee80fe860ab1b55072e943bbe66bf61b485d
Author: Philip Withnall <philip tecnocode co uk>
Date:   Thu Jul 8 21:40:07 2010 +0100

    [core] Use the error reason phrase if the response body is empty

 gdata/gdata-service.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/gdata/gdata-service.c b/gdata/gdata-service.c
index 07676aa..70bb2f4 100644
--- a/gdata/gdata-service.c
+++ b/gdata/gdata-service.c
@@ -419,6 +419,10 @@ static void
 real_parse_error_response (GDataService *self, GDataOperationType operation_type, guint status, const gchar *reason_phrase,
                            const gchar *response_body, gint length, GError **error)
 {
+	/* We prefer to include the @response_body in the error message, but if it's empty, fall back to the @reason_phrase */
+	if (response_body == NULL || *response_body == '\0')
+		response_body = reason_phrase;
+
 	/* See: http://code.google.com/apis/gdata/docs/2.0/reference.html#HTTPStatusCodes */
 	switch (status) {
 		case SOUP_STATUS_CANT_RESOLVE:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]