venkat-srinivasan-nexusflow commited on
Commit
26acc8d
β€’
1 Parent(s): a7316fd

Update tools.py

Browse files
Files changed (1) hide show
  1. tools.py +2 -2
tools.py CHANGED
@@ -114,7 +114,7 @@ class Tools:
114
  place_2 = place_2["name"]
115
 
116
  if len(latlong_1) == 0 or len(latlong_2) == 0:
117
- raise ValueError
118
 
119
  latlong1 = latlong_1[0]["geometry"]["location"]
120
  latlong2 = latlong_2[0]["geometry"]["location"]
@@ -161,7 +161,7 @@ class Tools:
161
  latlong = geocode_result[0]["geometry"]["location"]
162
  location = (latlong["lat"], latlong["lng"])
163
  else:
164
- raise ValueError("Could not geocode the provided location.")
165
 
166
  type_of_place = " ".join(type_of_place)
167
  # Perform the search using Google Places API
 
114
  place_2 = place_2["name"]
115
 
116
  if len(latlong_1) == 0 or len(latlong_2) == 0:
117
+ return "No place found for the query. Please be more explicit."
118
 
119
  latlong1 = latlong_1[0]["geometry"]["location"]
120
  latlong2 = latlong_2[0]["geometry"]["location"]
 
161
  latlong = geocode_result[0]["geometry"]["location"]
162
  location = (latlong["lat"], latlong["lng"])
163
  else:
164
+ return []
165
 
166
  type_of_place = " ".join(type_of_place)
167
  # Perform the search using Google Places API