Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better error handling #283

Merged
merged 3 commits into from
Mar 29, 2024
Merged

Better error handling #283

merged 3 commits into from
Mar 29, 2024

Conversation

kmcginnes
Copy link
Collaborator

@kmcginnes kmcginnes commented Mar 26, 2024

Description

Improves the error handling within Graph Explorer and the proxy server in various ways.

Client Side Changes

  • Add createDisplayError() function to map errors to friendly errors that can be displayed to the user (this will grow over time)
  • Use createDisplayError() in schema sync and keyword search
  • Check if response.ok for any useGEFetch() requests and throw an error if it is not
  • Attempt to decode error response bodies in a safe way

Server Side Changes

  • Move routes out of unnecessary async closure
  • Remove duplicate app.use(errorHandler)
  • Send error responses from the remote database through the proxy back to the client with minimal changes

Validation

  • When reviewing the code it will be useful to turn on the "ignore whitespace changes" feature in GitHub
  • Added tests for errors I know about
  • Disconnect VPC or wifi to get the connection refused error
  • Set fetch timeout for connection to something low (e.g. 50 ms) to get the fetch timeout error
  • Connect to large RDF dataset and do a keyword search with all nodes types, all predicates, and partial precision, then use a long series of characters in the query field (e.g. "aaaaaaaaaaaaa") to get the server timeout error

Schema sync failure (connection refused)

CleanShot 2024-03-26 at 10 48 56@2x

Fetch timeout

CleanShot 2024-03-26 at 10 50 14@2x

Neptune long query server timeout

CleanShot 2024-03-26 at 10 52 50@2x

Related Issues

Fixes issue #275

Check List

  • I confirm that my contribution is made under the terms of the Apache 2.0 license.
  • I have run pnpm run checks to ensure code compiles and meets standards.
  • I have run pnpm run test to check if all tests are passing.
  • I've covered new added functionality with unit tests if necessary.

Copy link

codecov bot commented Mar 27, 2024

Codecov Report

Attention: Patch coverage is 45.21739% with 63 lines in your changes are missing coverage. Please review.

Project coverage is 12.15%. Comparing base (7fbac1e) to head (2849d14).

Files Patch % Lines
...ackages/graph-explorer/src/connector/useGEFetch.ts 0.00% 46 Missing ⚠️
packages/graph-explorer/src/hooks/useSchemaSync.ts 0.00% 14 Missing ⚠️
...src/modules/KeywordSearch/useKeywordSearchQuery.ts 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #283      +/-   ##
==========================================
+ Coverage   12.02%   12.15%   +0.13%     
==========================================
  Files         410      411       +1     
  Lines       30481    30575      +94     
  Branches      764      776      +12     
==========================================
+ Hits         3665     3717      +52     
- Misses      26483    26525      +42     
  Partials      333      333              
Flag Coverage Δ
unittests 12.15% <45.21%> (+0.13%) ⬆️

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.

Copy link
Contributor

@vkagamlyk vkagamlyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@michaelnchin michaelnchin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @kmcginnes ! This should substantially improve user debugging.

@vkagamlyk vkagamlyk merged commit 2744e93 into aws:main Mar 29, 2024
3 checks passed
@kmcginnes kmcginnes deleted the better-error-handling branch March 29, 2024 15:26
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.

3 participants