fix: resolve flight search error handling issues (#274, #275)#446
Open
kristinemejia443-netizen wants to merge 1 commit into
Open
Conversation
fix: resolve flight search error handling issues (etherisc#274, etherisc#275) - Add axios error handling in proxy to forward Flightstats errors instead of crashing with 500 - Distinguish COMM_ERROR, INCONSISTENT_DATA, and NO_FLIGHT_FOUND error messages - Replace force-cache with no-store to prevent permanent caching of empty/error responses - Add null check on jsonResponse.appendix to prevent TypeError - Remove fake default Flightstats credentials (123456789) that silently mask missing env vars - Validate departure date format in schedule route Co-Authored-By: Claude Opus 4.7 <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
This PR addresses 6 root-cause bugs in the flight search data flow that produced misleading or incorrect error messages:
proxy.ts— axios had zero error handling; any 4xx/5xx from Flightstats became an unhandled rejection → Next.js 500 →COMM_ERROR→ generic "No matching flight found". Now properly forwards Flightstats error responses.application_error.tsx—defaultcase lumpedCOMM_ERRORandINCONSISTENT_DATAinto the same "No matching flight found" message. Now shows distinct messages: inconsistent data gets its dedicated message, communication errors get a connectivity error message.use_flightstats_api.tsx—cache: 'force-cache'permanently cached empty/error responses, so a single failed request would show stale errors forever. Changed tono-store.use_flightstats_api.tsx— No null check onjsonResponse.appendixbefore accessing.airports, causing a TypeError if Flightstats omits the appendix field.api_constants.ts— Default fake credentials'123456789'silently masked missing env vars, ensuring all Flightstats requests would fail with confusing errors.route.ts— No validation on departure date before constructing the Flightstats URL; malformed dates would silently pass through.Test plan
COMM_ERROR,INCONSISTENT_DATA,NO_FLIGHT_FOUND🤖 Generated with Claude Code