Skip to content

Improve error details and handle proxy connection errors#1650

Merged
kmcginnes merged 6 commits intoaws:mainfrom
kmcginnes:improve-error-details
Apr 9, 2026
Merged

Improve error details and handle proxy connection errors#1650
kmcginnes merged 6 commits intoaws:mainfrom
kmcginnes:improve-error-details

Conversation

@kmcginnes
Copy link
Copy Markdown
Collaborator

@kmcginnes kmcginnes commented Apr 8, 2026

Description

Incremental improvements to error handling and display, building on #1644:

  • Introduce ServerConnectionError for when fetch fails to reach the server, capturing the request URL and original cause for diagnostics
  • Detect cross-origin mismatches between the proxy server URL and the browser origin, showing a targeted CORS error message
  • Consolidate the private extractMessageFromData in createDisplayError.ts into the shared extractErrorMessage utility and move it from connector/ to utils/
  • Simplify decodeErrorSafely to return raw text for non-JSON responses instead of wrapping in { message }, since extractErrorMessage handles plain strings directly
  • Add statusText lookup to NetworkError for human-readable status names in error details
  • Widen ErrorDetails.message to string | undefined and conditionally hide the message field in the error details dialog when undefined
  • Add a comment explaining why serializeCause sets name explicitly (it lives on the prototype, not as an own property)
  • Wrap all TypeError exceptions from fetch() as ServerConnectionError for cross-browser compatibility (Chrome, Firefox, Safari use different messages for network failures)
  • Tighten hasOriginMismatch parameter type from string | undefined to string
  • Add comprehensive test suites for fetchDatabaseRequest, NetworkError, ServerConnectionError, createDisplayError, and createErrorDetails

Validation

  • pnpm checks passes (lint, format, types)
  • pnpm test passes with no failures

Related Issues

Check List

  • I confirm that my contribution is made under the terms of the Apache 2.0 license.
  • I have verified pnpm checks passes with no errors.
  • I have verified pnpm test passes with no failures.
  • I have covered new added functionality with unit tests if necessary.
  • I have updated documentation if necessary.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 8, 2026

Codecov Report

❌ Patch coverage is 95.12195% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.88%. Comparing base (c5affc5) to head (8362333).
⚠️ Report is 122 commits behind head on main.

Files with missing lines Patch % Lines
...kages/graph-explorer/src/components/PanelError.tsx 75.00% 1 Missing ⚠️
...ges/graph-explorer/src/utils/createDisplayError.ts 94.73% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1650       +/-   ##
===========================================
+ Coverage   47.81%   63.88%   +16.06%     
===========================================
  Files         382      396       +14     
  Lines        8525     9247      +722     
  Branches     3159     3521      +362     
===========================================
+ Hits         4076     5907     +1831     
+ Misses       3070     2310      -760     
+ Partials     1379     1030      -349     
Flag Coverage Δ
unittests 63.88% <95.12%> (+16.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kmcginnes kmcginnes force-pushed the improve-error-details branch from 77e4d51 to c5d8a97 Compare April 8, 2026 01:36
@kmcginnes kmcginnes marked this pull request as ready for review April 8, 2026 01:39
- Fix ErrorDetails.message type to allow undefined
- Hide error message field in dialog when undefined
- Consolidate extractMessageFromData into extractErrorMessage
- Add comment explaining serializeCause name handling
- Add tests for NetworkError and fetchDatabaseRequest
- Simplify decodeErrorSafely to return raw text for non-JSON responses
  instead of wrapping in { message } since extractErrorMessage handles
  strings directly
@kmcginnes kmcginnes force-pushed the improve-error-details branch from c5d8a97 to 244c86a Compare April 8, 2026 19:34
@kmcginnes kmcginnes changed the title Improve error details and add test coverage Improve error details and handle proxy connection errors Apr 8, 2026
* Add security policy and security audit workflow

* Address review feedback for security audit workflow

* Remove pnpm audit step from security audit workflow

* Remove SLA and public issue instruction
* Remove ExplorerInjector component

The ExplorerInjector was originally added to inject the explorer instance
into the query client meta field and clear the cache on connection change.
Both responsibilities are already handled elsewhere:

- The store is injected at query client creation time in createQueryClient()
- Cache clearing happens via queryClient.removeQueries() in useResetState(),
  which is called at every connection switch point

Resolves aws#1646

* Add tests for createQueryClient and useResetState
@kmcginnes kmcginnes merged commit e410073 into aws:main Apr 9, 2026
3 checks passed
@kmcginnes kmcginnes deleted the improve-error-details branch April 9, 2026 15:12
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.

Connection timeout results in TypeError

2 participants