[geocode-glib] geoip-lookup: Update error JSON format
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geocode-glib] geoip-lookup: Update error JSON format
- Date: Wed, 3 Apr 2013 17:24:32 +0000 (UTC)
commit dbf20e661919ce1591d75e79c9ebc4ccf49afa22
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 682bc24..5a6dfee 100644
--- a/geocode-glib/geocode-ip-server/geoip-lookup.c
+++ b/geocode-glib/geocode-ip-server/geoip-lookup.c
@@ -11,8 +11,8 @@
static const char *attribution_text = "This product includes GeoLite data created by MaxMind, available from
http://www.maxmind.com\n";
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."
};
@@ -20,12 +20,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]