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

Wrap neo4j driver exceptions in ActiveGraph::Core::CypherError family #1640

Closed

Conversation

joshjordan
Copy link
Contributor

@joshjordan joshjordan commented Dec 22, 2020

This is a straw man solution for #1639

I do not expect this is ultimately how we want to solve it, but rather, opening this PR as an example that satisfies the tests in my application (which are looking for ActiveGraph:Core::SchemaErrors::ConstraintValidationFailedError)

If you can give me instructions on where to make the proper fix and what you'd like to see in terms of testing, I can fix up this PR.

@klobuczek
Copy link
Member

The idea was not to translate the driver exceptions. The driver has a very detailed exception hierarchy which I would prefer not to replicate. Some errors are only differentiable by message rather than exception class type. I would say the vast majority of those exceptions if not all are not recoverable in activegraph so they have only a debug value. The driver exceptions serve this purpose well. But you are right that the unused exception classes should be removed from the code. They orginate from times where there was no driver and the whole error system was driven by the http adapter. I think the clean up is the only thing we should do at the moment.
In general, I try to expose as many aspects of the driver as possible so ActiveGraph::Core::Node is as well Neo4j::Driver::Node etc. That allows using of the driver and active graph interchangeably.

@joshjordan
Copy link
Contributor Author

joshjordan commented Dec 23, 2020 via email

@klobuczek
Copy link
Member

@joshjordan could you give me some examples of how you react differently to different exception classes? I was under the impression that there is not much more you can do beyond simply logging those exceptions.

@klobuczek
Copy link
Member

@joshjordan just looked through the code. ClientException should have a code attribute e.g. Neo.ClientError.Schema.ConstraintValidationFailed. See https://neo4j.com/docs/status-codes/current/. Let me know if that's not working for you. I know it's an additional check within the rescue clause. However, there are over 120 such codes. Creating an exception class for each of them would be overkill.

@klobuczek klobuczek deleted the branch neo4jrb:master January 1, 2024 19:22
@klobuczek klobuczek closed this Jan 1, 2024
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.

2 participants