[gnome-maps/wip/routing2] fixupRouteService



commit 0ace68ce373bfe21fe8b810f7534d566bb7fa8b4
Author: Mattias Bengtsson <mattias jc bengtsson gmail com>
Date:   Sat May 24 01:50:34 2014 +0100

    fixupRouteService

 src/routeService.js |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/src/routeService.js b/src/routeService.js
index 2cba681..1800cad 100644
--- a/src/routeService.js
+++ b/src/routeService.js
@@ -70,7 +70,7 @@ const GraphHopper = new Lang.Class({
         this._session.queue_message(msg, (function(session, message) {
             try {
                 let result = this._parseMessage(message);
-                if(result.info && result.info.errors) {
+                if(result.info) {
                     Application.notificationManager.showMessage(_("No route found."));
                     Utils.debug("No route found:");
                     result.info.errors.forEach(function({ message, details }) {
@@ -106,9 +106,6 @@ const GraphHopper = new Lang.Class({
     },
 
     _parseMessage: function({ status_code, response_body, uri }) {
-        if (status_code === 200)
-            return JSON.parse(response_body.data);
-
         if(status_code === 500) {
             log("Internal server error.\n"
                 + "This is most likely a bug in GraphHopper");
@@ -116,7 +113,10 @@ const GraphHopper = new Lang.Class({
                 + "with the the following Graphopper request URL included:\n");
             log(uri.to_string(false));
         }
-        return null;
+        if (status_code !== 200)
+            return null;
+
+        return JSON.parse(response_body.data);
     },
 
     _createRoute: function(route) {


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