ING-865: Update error information to include extra context#348
Merged
Conversation
bcfa635 to
77db4a5
Compare
There was a problem hiding this comment.
Pull request overview
This pull request enhances error messages across the gateway by adding contextual information to help users identify the specific field or operation index that caused an error. The changes focus on CAS validation errors and subdocument operation errors.
Changes:
- Enhanced
NewZeroCasStatusto accept acasFieldparameter for more specific error messages - Updated subdocument error handlers to include operation index in error messages for batch operations (LookupIn, MutateIn)
- Added new
NewProjectPathInvalidStatusandNewProjectPathMismatchStatusmethods for single-operation projection errors without index information
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| gateway/dataimpl/server_v1/errorhandler.go | Added casField parameter to NewZeroCasStatus, added sdIndex parameter to subdocument error handlers, created new Project* methods for non-batch operations |
| gateway/dataimpl/server_v1/xdcrserver.go | Updated checkCAS function signature to accept casField parameter and pass it to NewZeroCasStatus, updated inline CheckCas validation calls |
| gateway/dataimpl/server_v1/kvserver.go | Updated subdocument error handler calls to include operation index, switched to new Project* methods for Get operation, updated checkCAS to pass empty string to NewZeroCasStatus |
Comments suppressed due to low confidence (1)
gateway/dataimpl/server_v1/kvserver.go:1419
- The
checkCASfunction in KvServer is inconsistent with the updated pattern in XdcrServer. In XdcrServer, thecheckCASfunction was updated to accept acasFieldparameter (line 866 in xdcrserver.go) which is passed through toNewZeroCasStatus. However, in KvServer, the function still uses the old signature and always passes an empty string toNewZeroCasStatus. This means KvServer callers will always get the generic error message "CAS value cannot be zero." instead of the more specific message like "CAS value for 'Cas' cannot be zero."
Consider updating the checkCAS function signature to accept a casField parameter and updating all call sites (lines 247, 554, 646, 870, 935, 1127) to pass the appropriate field name (e.g., "Cas").
func (s *KvServer) checkCAS(ctx context.Context, cas *uint64) *status.Status {
if cas != nil && *cas == 0 {
return s.errorHandler.NewZeroCasStatus(ctx, "")
}
return nil
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Westwooo
approved these changes
Feb 17, 2026
77db4a5 to
83a061b
Compare
brett19
approved these changes
Feb 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.