-
Notifications
You must be signed in to change notification settings - Fork 16
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
Extend error response with additional information #1325
Conversation
If the
By default, the flag is disabled, and the error response will not be changed:
|
src/main/java/io/stargate/sgv2/jsonapi/exception/JsonApiException.java
Outdated
Show resolved
Hide resolved
src/main/java/io/stargate/sgv2/jsonapi/exception/JsonApiException.java
Outdated
Show resolved
Hide resolved
...ine/io/stargate/sgv2/jsonapi/service/operation/model/impl/OfflineGetStatusOperationTest.java
Outdated
Show resolved
Hide resolved
src/main/java/io/stargate/sgv2/jsonapi/config/OperationsConfig.java
Outdated
Show resolved
Hide resolved
src/main/java/io/stargate/sgv2/jsonapi/exception/ErrorCode.java
Outdated
Show resolved
Hide resolved
src/main/java/io/stargate/sgv2/jsonapi/exception/JsonApiException.java
Outdated
Show resolved
Hide resolved
src/main/java/io/stargate/sgv2/jsonapi/exception/JsonApiException.java
Outdated
Show resolved
Hide resolved
src/main/java/io/stargate/sgv2/jsonapi/exception/JsonApiException.java
Outdated
Show resolved
Hide resolved
src/main/java/io/stargate/sgv2/jsonapi/exception/JsonApiException.java
Outdated
Show resolved
Hide resolved
src/main/java/io/stargate/sgv2/jsonapi/exception/JsonApiException.java
Outdated
Show resolved
Hide resolved
@@ -803,7 +802,7 @@ public void happyPathWithEmptyVector() { | |||
.body("errors", hasSize(1)) | |||
.body("errors[0].exceptionClass", is("JsonApiException")) | |||
.body("errors[0].errorCode", is("SHRED_BAD_VECTOR_SIZE")) | |||
.body("errors[0].message", is(ErrorCode.SHRED_BAD_VECTOR_SIZE.getMessage())); | |||
.body("errors[0].message", is("$vector value can't be empty")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why this was changed? Earlier code more robust wrt changes to error message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because I added extendError
- the configuration in the ErrorCode
class. It will cause the class initialization error in this case - because it cannot find the config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. We will probably change things to ensure that no loading occurs from within static initialization of ErrorCode
(or its replacement) in future.
But is fine for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
couple of changes ot the way we are creating the family / scope - but I am still happy with the general approach rather than changing all of the existing ErrorCode enum
PROJECTION("PROJECTION"), | ||
SCHEMA("SCHEMA"), | ||
SORT("SORT"), | ||
UPDATE("UPDATE"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there also be an error scope for OPTIONS if you pass in an invalid option?
What this PR does:
Extend error response with additional information
The matching family and scope for each error code are here
Which issue(s) this PR fixes:
Fixes NA
Checklist