better error message on restapi3.py
diff --git a/web/restapi3.py b/web/restapi3.py
index 546f2a7..001faa6 100755
--- a/web/restapi3.py
+++ b/web/restapi3.py
@@ -13,7 +13,7 @@
 ## Global Var ##
 RestIP="127.0.0.1"
 RestPort=8182
-DBName="Cassandra-Netmap"
+DBName="onos-network-map"
 
 DEBUG=1
 pp = pprint.PrettyPrinter(indent=4)
@@ -34,17 +34,26 @@
     result = os.popen(command).read()
     parsedResult = json.loads(result)['results']
   except:
-    log_error("REST IF has issue")
-    exit
+    log_error("REST IF has issue: %s" % command)
+    log_error("%s" % result)
+    sys.exit(0)
 
   debug("portV_to_dpid %s" % command)
   debug("parsed %s" % parsedResult)
+
+  found = 0
   for v in parsedResult:
     if v.has_key('type') and v['type'] == "switch":
+      found = 1
       sw_dpid = v['dpid']
       break
 
-  return sw_dpid
+  if not found:
+    log_error("No switch attached to port vertex %d" % vertex)
+    sys.exit(0)
+  else:
+    return sw_dpid
+
 
 def switchV_to_dpid(vertex):
   try:
@@ -52,13 +61,14 @@
     result = os.popen(command).read()
     parsedResult = json.loads(result)['results']
   except:
-    log_error("REST IF has issue")
-    exit
+    log_error("REST IF has issue: %s" % command)
+    log_error("%s" % result)
+    sys.exit(0)
 
   debug("switchV_to_dpid %s" % command)
   if not parsedResult.has_key("type") or parsedResult['type'] != "switch":
     print "not a switch vertex"
-    exit
+    sys.exit(0)
   else:
     sw_dpid = parsedResult['dpid']
 
@@ -70,8 +80,9 @@
     result = os.popen(command).read()
     parsedResult = json.loads(result)['results']
   except:
-    log_error("REST IF has issue")
-    exit
+    log_error("REST IF has issue: %s" % command)
+    log_error("%s" % result)
+    sys.exit(0)
 
   debug("portV_to_port_dpid %s" % command)
   port_number = parsedResult['number']
@@ -85,8 +96,9 @@
     result = os.popen(command).read()
     parsedResult = json.loads(result)['results']
   except:
-    log_error("REST IF has issue")
-    exit
+    log_error("REST IF has issue: %s" % command)
+    log_error("%s" % result)
+    sys.exit(0)
     
   port = parsedResult[0]['number']
   vertex = parsedResult[0]['_id']
@@ -132,8 +144,9 @@
     result = os.popen(command).read()
     parsedResult = json.loads(result)['results']
   except:
-    log_error("REST IF has issue")
-    exit
+    log_error("REST IF has issue: %s" % command)
+    log_error("%s" % result)
+    sys.exit(0)
 
   devices = []
   for v in parsedResult:
@@ -193,8 +206,9 @@
     result = os.popen(command).read()
     parsedResult = json.loads(result)['results']
   except:
-    log_error("REST IF has issue")
-    exit
+    log_error("REST IF has issue: %s" % command)
+    log_error("%s" % result)
+    sys.exit(0)
 
   switches_ = []
   for v in parsedResult:
@@ -219,8 +233,9 @@
     result = os.popen(command).read()
     parsedResult = json.loads(result)['results']
   except:
-    log_error("REST IF has issue")
-    exit
+    log_error("REST IF has issue: %s" % command)
+    log_error("%s" % result)
+    sys.exit(0)
 
   debug("query_links %s" % command)
   pp.pprint(parsedResult)
@@ -234,10 +249,10 @@
       result = os.popen(command).read()
       linkResults = json.loads(result)['results']
     except:
-      log_error("REST IF has issue")
-      exit
+      log_error("REST IF has issue: %s" % command)
+      log_error("%s" % result)
+      sys.exit(0)
 
- #   print linkResults
     for p in linkResults:
       if p.has_key('type') and p['type'] == "port":
         dstport = p['_id']