[evolution-data-server] Provide at least some NSPR error text, rather than cryptic error code



commit 4cf5faad83369f3a5d399ac3972bad9e1d0844c7
Author: Milan Crha <mcrha redhat com>
Date:   Fri Mar 2 12:19:23 2012 +0100

    Provide at least some NSPR error text, rather than cryptic error code

 camel/camel-tcp-stream-raw.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/camel/camel-tcp-stream-raw.c b/camel/camel-tcp-stream-raw.c
index 3bb8b24..356f425 100644
--- a/camel/camel-tcp-stream-raw.c
+++ b/camel/camel-tcp-stream-raw.c
@@ -284,9 +284,16 @@ tcp_stream_set_error_from_pr_error (GError **error)
 		error_message = g_malloc0 (length + 1);
 		PR_GetErrorText (error_message);
 	} else {
-		g_warning (
-			"NSPR error code %d has no text",
-			PR_GetError ());
+		const gchar *str = PR_ErrorToString (PR_GetError (), PR_LANGUAGE_I_DEFAULT);
+		if (!str || !*str)
+			str = PR_ErrorToName (PR_GetError ());
+
+		if (str && *str)
+			error_message = g_strdup (str);
+		else
+			g_warning (
+				"NSPR error code %d has no text",
+				PR_GetError ());
 	}
 
 	_set_errno_from_pr_error (PR_GetError ());



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