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

Errors in response #350

Closed
maheshrajamani opened this issue Apr 13, 2023 · 3 comments · Fixed by #369
Closed

Errors in response #350

maheshrajamani opened this issue Apr 13, 2023 · 3 comments · Fixed by #369
Assignees

Comments

@maheshrajamani
Copy link
Contributor

maheshrajamani commented Apr 13, 2023

If there is an error thrown during deserialization of commands, response has array of errors as below. The error message in index 0 adds no value. In my opinion it needs to be removed.
Also the error code is missing on the raised error, in this case expecting "errorCode" : INVALID_FILTER_EXPRESSION

{ "errors": [ { "message": "$in operator must have at least one value (through reference chain: io.stargate.sgv2.jsonapi.api.model.command.impl.FindOneCommand[\"filter\"])", "exceptionClass": "JsonMappingException" }, { "message": "$in operator must have at least one value", "exceptionClass": "JsonApiException" } ] }

@ivansenic @amorton @tatu-at-datastax

@tatu-at-datastax
Copy link
Contributor

Yeah we definitely want errorCode to be added at very least. And duplicate errors (due to wrapping?) seems wrong too, agreed. Not sure if we could easily avoid wrapping: JsonMappingException does not have errorCode so we need JsonApiException and it makes sense usually to link source (cause). But maybe serializer could avoid adding the full chain.

@ivansenic
Copy link
Contributor

@maheshrajamani @tatu-at-datastax The cause was added as the second error, as in many cases it can help understand what was the original cause.. It's not only for users, but also for us later on.. The behavior is standardized , no matter if the cause is JsonApiException or not..

Even in the example above, for me the error at index [0] makes sense. You get the info about the reference chain, and that filter is wrong.. The second exception is the cause, it could be anything, not only JsonApiException so for me also valuable.. I would vote to stay like it is? Or if you insist what would be the rule then here, don't include cause if it's JsonApiException or don't include at all?

Regarding the errorCode you are right, there is a bug in the current code and I am going to fix that.

@tatu-at-datastax
Copy link
Contributor

@ivansenic This sounds good to me -- we can re-visit this if need be, but I agree that ability to have multiple failures is useful; and in cases we don't want that, avoiding adding (or suppressing) cause makes sense.
Maybe we can also see if suppressing duplicate failures makes sense (literally same fail message) or something.

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 a pull request may close this issue.

3 participants