Closed aburmeis closed 1 year ago
Thanks for your contribution! I also think that in the next major release we should upgrade both:
Can you rebase https://github.com/arangodb/spring-data/pull/280 on next branch?
@rashtao rebased on next
@rashtao thanks for handling the pr!
For the index handling change I am sorry, I should have done this in an extra PR.
The change to deleteById()
and query()
error handling are bugfixes imho. deleteById() has a contract telling unknown ids are ignored (see spring data javadoc). Using derived or annotated queries you currently have to deal with ArangoDbException
instead of DataAccessExceptions
as you would expect from a Spring Data implementation. To do such a change, a major update as this will be anyway, would be the best time to fix this.
@aburmeis
I agree, I reverted those changes from the PR just to be able to move forward faster, reducing the scope of it and avoiding to merge things that need further changes. Feel free to open new PRs for them.
Wrt deleteById()
, the problem I saw in the code is that it catches InvalidDataAccessResourceUsageException
which is thrown in case of any HTTP response status code 404
:
This is incorrect, since 404
could also be returned if the db or the collection are not found, in which cases an exception should be thrown.
To restrict the case to document not found, a match on errorNum == 1202
should be added, see https://github.com/arangodb/arangodb/blob/devel/lib/Basics/errors.dat#L96
About other exceptions handling, as I wrote above, the translation does not encompass all the cases and could produce misleading effects (e.g. throwing OptimisticLockingFailureException
in case of timeouts). Also here, we can work together in a new PR.
About exception translation in query()
, I am sorry, but I overlooked it and erroneously reverted it:
Feel free to re-add it in a new PR, or I would do it if you do not mind.
created new issue #281 for the exception handling