[libgdata/libgdata-0-6] core: Use the error reason phrase if the response body is empty



commit 868ce5d5b1586e43c193daaaf3b6ea0acb2de3d5
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 b36102f..bd0d872 100644
--- a/gdata/gdata-service.c
+++ b/gdata/gdata-service.c
@@ -332,6 +332,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]