[geocode-glib] lib: Add support for more error codes



commit a5f8bdd0ec63f8770a3248c55dc32cc6fcf5578f
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Apr 21 17:33:27 2011 +0100

    lib: Add support for more error codes

 geocode-glib/geocode-glib.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/geocode-glib/geocode-glib.c b/geocode-glib/geocode-glib.c
index 2c6f3bf..86f6a93 100644
--- a/geocode-glib/geocode-glib.c
+++ b/geocode-glib/geocode-glib.c
@@ -103,6 +103,7 @@ geocode_object_add (GeocodeObject *object,
 {
 	g_return_if_fail (GEOCODE_IS_OBJECT (object));
 	g_return_if_fail (key != NULL);
+	g_return_if_fail (value == NULL || g_utf8_validate (value, -1, NULL));
 
 	g_hash_table_insert (object->priv->ht,
 			     g_strdup (key),
@@ -155,6 +156,24 @@ _geocode_parse_json (const char *contents,
 		case 1:
 			g_set_error_literal (error, GEOCODE_ERROR, GEOCODE_ERROR_NOT_SUPPORTED, msg ? msg : "Query not supported");
 			break;
+		case 100:
+			g_set_error_literal (error, GEOCODE_ERROR, GEOCODE_ERROR_NOT_SUPPORTED, msg ? msg : "No input parameters");
+			break;
+		case 102:
+			g_set_error_literal (error, GEOCODE_ERROR, GEOCODE_ERROR_NOT_SUPPORTED, msg ? msg : "Address data not recognized as valid UTF-8");
+			break;
+		case 103:
+			g_set_error_literal (error, GEOCODE_ERROR, GEOCODE_ERROR_NOT_SUPPORTED, msg ? msg : "Insufficient address data");
+			break;
+		case 104:
+			g_set_error_literal (error, GEOCODE_ERROR, GEOCODE_ERROR_NOT_SUPPORTED, msg ? msg : "Unknown language");
+			break;
+		case 105:
+			g_set_error_literal (error, GEOCODE_ERROR, GEOCODE_ERROR_NOT_SUPPORTED, msg ? msg : "No country detected");
+			break;
+		case 106:
+			g_set_error_literal (error, GEOCODE_ERROR, GEOCODE_ERROR_NOT_SUPPORTED, msg ? msg : "Country not supported");
+			break;
 		default:
 			if (msg == NULL)
 				g_set_error (error, GEOCODE_ERROR, GEOCODE_ERROR_PARSE, "Unknown error code %"G_GINT64_FORMAT, err_code);



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