You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: improve transit error messages for unsupported regions (#75)
* fix: improve transit error messages for unsupported regions (#74)
The Google Routes API does not support transit directions in some
regions (notably Japan and India). Previously, users received a
generic "No route found" error. Now the error message clearly
explains the regional limitation and suggests alternatives.
- computeRoutes: detect transit mode + empty routes → descriptive error
- computeRouteMatrix: track ROUTE_NOT_FOUND count, throw on all-fail,
attach warning on partial-fail for transit mode
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* test: add transit error message tests for unsupported regions
Adds Test 8 to smoke tests verifying:
- Transit directions in Japan returns isError with descriptive message
- Transit distance matrix in Japan returns descriptive error
- Driving directions baseline still works (graceful on transient API issues)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: avoid passing default departureTime to Routes API
PlacesSearcher.getDirections defaulted to `new Date()` when no
departure_time was provided, but Routes API rejects past timestamps
causing sporadic "Timestamp must be set to a future time" errors.
Now omits departureTime entirely when not explicitly provided,
letting the Routes API use its own default behavior.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* docs: add departureTime fix to CHANGELOG
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* style: format RoutesService and PlacesSearcher with Prettier
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
`No transit routes found for any origin/destination pair. `+
299
+
`The Google Routes API does not support transit directions in some regions (notably Japan and India). `+
300
+
`Try using mode "driving" or "walking" instead, or use a regional transit service for public transportation details.`
301
+
);
302
+
}
303
+
282
304
// Routes API doesn't return resolved addresses; use input strings
283
305
return{
284
306
distances,
285
307
durations,
286
308
origin_addresses: params.origins,
287
309
destination_addresses: params.destinations,
310
+
...(routeNotFoundCount>0&&travelMode==="TRANSIT"
311
+
? {
312
+
warning: `${routeNotFoundCount} of ${totalPairs} origin/destination pairs returned no transit route. The Google Routes API has limited transit coverage in some regions.`,
0 commit comments