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

chore: harmonize error handling #71

Merged
merged 4 commits into from
Sep 4, 2023
Merged

Conversation

ClemDoum
Copy link
Collaborator

@ClemDoum ClemDoum commented Aug 9, 2023

PR description

Harmonize error handling in order to:

  • log normalized messages
  • return normalized HTTP errors
  • avoid returning traces containing potential logs in http responses

Changes

datashare-neo4j-extension/src

Changed

  • udpated HttpError to avoid deserializing the trace attribute, this way no trace information will be returned by the HTTP. In order to be able to log message with traces a HttpError.getMessageWithTrace() method was added
  • removed inheritance between Neo4jAppError and HttpError to isolate their behavior. Neo4jAppError represents a error returned by the Python application, it serialization had not reason to be bound to the HttpError serialization/deserialization
  • improved Java error handling by catching error locally and throwing detailed RuntimeError
  • refactored wrapNeo4jAppCall to reformat any unhandled exception into the HttpError using HttpError.fromException which converts any exception in a single format. The wrapper logs error with trace and return HTTP errors without traces
  • refactored all API routes to be fully wrapped into the wrapNeo4jAppCall, the deserialization of the incoming payload is done using the parseContext function which raise a custom BadRequest error which it later caught and reformatted into the HttpError. This allows to return normalized errors in case of a 400 error rather than retuning the non formatted error from fluent

datashare-neo4j-extension/pom.xml

Fixed

  • include test files in the files checked using ./neo4j format_test_java and updated java files accordingly

@ClemDoum ClemDoum force-pushed the chore/improve-error-handling branch from a1bf86c to 3271d3d Compare August 9, 2023 16:43
@ClemDoum ClemDoum mentioned this pull request Aug 23, 2023
3 tasks
@ClemDoum ClemDoum self-assigned this Aug 23, 2023
@ClemDoum ClemDoum force-pushed the chore/improve-error-handling branch from adf58fd to 5014422 Compare August 24, 2023 14:22
@ClemDoum ClemDoum force-pushed the chore/improve-error-handling branch from 5014422 to 4538987 Compare August 24, 2023 14:34
@ClemDoum ClemDoum marked this pull request as ready for review August 24, 2023 14:50
@ClemDoum ClemDoum requested a review from a team as a code owner August 24, 2023 14:50
@ClemDoum ClemDoum added the java label Aug 24, 2023
@ClemDoum ClemDoum merged commit 531a5ec into main Sep 4, 2023
3 checks passed
@ClemDoum ClemDoum deleted the chore/improve-error-handling branch September 4, 2023 07:12
@ClemDoum
Copy link
Collaborator Author

ClemDoum commented Sep 4, 2023

Thanks for the review @pirhoo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants