[geocode-glib/gnome-maps: 2/9] geoip-lookup: Update error JSON format
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geocode-glib/gnome-maps: 2/9] geoip-lookup: Update error JSON format
- Date: Wed, 27 Mar 2013 01:39:17 +0000 (UTC)
commit d5c5c2e0d2d98822e0f612cb9b8739f3ff5eb075
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Tue Mar 26 20:15:11 2013 +0200
geoip-lookup: Update error JSON format
The JSON format for errors should be the same as normal JSON replies.
Since we changed that, we should change this as well.
https://bugzilla.gnome.org/show_bug.cgi?id=696525
geocode-glib/geocode-ip-server/geoip-lookup.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/geocode-glib/geocode-ip-server/geoip-lookup.c b/geocode-glib/geocode-ip-server/geoip-lookup.c
index 0331572..cebc198 100644
--- a/geocode-glib/geocode-ip-server/geoip-lookup.c
+++ b/geocode-glib/geocode-ip-server/geoip-lookup.c
@@ -14,8 +14,8 @@ enum ERROR_CODES {
DATABASE_ERR
};
static char *error_message_array [] = {
- "Invalid IP address input",
- "Can not find the IP address in the database",
+ "Invalid IP address '%s'",
+ "Can not find the IP address '%s' in the database",
"Can not open GeoLiteCity/GeoIP Binary database. Set GEOIP_DATABASE_PATH env variable."
};
@@ -23,12 +23,12 @@ static void
print_error_in_json (int error_code,
const char *extra_info)
{
- g_print ("{\"results\":\"%s",error_message_array[error_code]);
+ g_print ("{\"error_code\":%d, \"error_message\":\"", error_code);
if (extra_info)
- g_print (" - %s\"", extra_info);
+ g_print (error_message_array[error_code], extra_info);
else
- g_print ("\"");
- g_print (",\"status\":\"ERROR\"}\n");
+ g_print (error_message_array[error_code]);
+ g_print ("\"}\n");
}
static JsonBuilder*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]