Skip to content

fix: improve transit error messages for unsupported regions#75

Merged
cablate merged 5 commits intomainfrom
fix/transit-error-messages
Apr 19, 2026
Merged

fix: improve transit error messages for unsupported regions#75
cablate merged 5 commits intomainfrom
fix/transit-error-messages

Conversation

@cablate
Copy link
Copy Markdown
Owner

@cablate cablate commented Apr 19, 2026

Summary

Closes #74

  • The Google Routes API does not support transit directions in some regions (notably Japan and India), returning empty routes instead of a meaningful error
  • Previously users saw a generic No route found message with no explanation
  • Now computeRoutes detects transit + empty routes and returns a clear message explaining the regional limitation with suggested alternatives
  • computeRouteMatrix tracks ROUTE_NOT_FOUND counts: throws a descriptive error when all pairs fail, attaches a warning field on partial failure

Affected tools

All 4 tools that accept transit mode are covered via the shared RoutesService layer:

  • maps_directions
  • maps_plan_route
  • maps_distance_matrix
  • maps_search_along_route

Test plan

  • Verify maps_directions with transit mode in Japan returns the improved error message
  • Verify maps_directions with driving mode is unaffected
  • Verify maps_distance_matrix with transit mode in Japan throws descriptive error (all-fail case)
  • Verify build passes (npm run build)

🤖 Generated with Claude Code

cablate and others added 5 commits April 19, 2026 20:17
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>
@cablate cablate merged commit 84a4595 into main Apr 19, 2026
1 check passed
@cablate cablate deleted the fix/transit-error-messages branch April 19, 2026 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

maps_directions transit mode returns "No route found" in Japan

1 participant