Skip to content

ING-865: Update error information to include extra context#348

Merged
chvck merged 1 commit intomasterfrom
ing-865_error_information
Feb 17, 2026
Merged

ING-865: Update error information to include extra context#348
chvck merged 1 commit intomasterfrom
ing-865_error_information

Conversation

@chvck
Copy link
Collaborator

@chvck chvck commented Feb 16, 2026

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 NewZeroCasStatus to accept a casField parameter for more specific error messages
  • Updated subdocument error handlers to include operation index in error messages for batch operations (LookupIn, MutateIn)
  • Added new NewProjectPathInvalidStatus and NewProjectPathMismatchStatus methods 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 checkCAS function in KvServer is inconsistent with the updated pattern in XdcrServer. In XdcrServer, the checkCAS function was updated to accept a casField parameter (line 866 in xdcrserver.go) which is passed through to NewZeroCasStatus. However, in KvServer, the function still uses the old signature and always passes an empty string to NewZeroCasStatus. 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.

@chvck chvck force-pushed the ing-865_error_information branch from 77db4a5 to 83a061b Compare February 17, 2026 10:37
@chvck chvck merged commit 03add4c into master Feb 17, 2026
26 checks passed
@chvck chvck deleted the ing-865_error_information branch February 17, 2026 18:06
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.

4 participants