fix: improve transit error messages for unsupported regions#75
Merged
Conversation
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>
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>
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>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #74
No route foundmessage with no explanationcomputeRoutesdetects transit + empty routes and returns a clear message explaining the regional limitation with suggested alternativescomputeRouteMatrixtracksROUTE_NOT_FOUNDcounts: throws a descriptive error when all pairs fail, attaches awarningfield on partial failureAffected tools
All 4 tools that accept
transitmode are covered via the sharedRoutesServicelayer:maps_directionsmaps_plan_routemaps_distance_matrixmaps_search_along_routeTest plan
maps_directionswith transit mode in Japan returns the improved error messagemaps_directionswith driving mode is unaffectedmaps_distance_matrixwith transit mode in Japan throws descriptive error (all-fail case)npm run build)🤖 Generated with Claude Code