Skip to content

Conversation

@hrntknr
Copy link
Member

@hrntknr hrntknr commented Aug 19, 2025

Summary

Improves error handling in the KVS repository update method by properly checking if a key exists before attempting to update it and providing better error messages for JSON marshalling failures.

Type of Change

  • fix: A bug fix

Related Issues

Changes Made

  • Added existence check for key before update operation
  • Return fosite.ErrNotFound when attempting to update non-existent key
  • Improved error message for JSON marshalling failures from generic ErrNotFound to more descriptive error

Testing

The changes improve error handling consistency and provide more accurate error responses when operations fail.

- Check if key exists before attempting update
- Return ErrNotFound when key doesn't exist
- Improve error message for JSON marshalling failures
Copilot AI review requested due to automatic review settings August 19, 2025 13:58
Copy link
Contributor

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 PR improves error handling in the KVS repository's update method by adding proper existence checks and providing more descriptive error messages for marshalling failures.

  • Added key existence validation before attempting update operations
  • Replaced generic error responses with more specific and descriptive error messages
  • Enhanced error handling consistency by returning appropriate errors for different failure scenarios

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

data, err := json.Marshal(value)
if err != nil {
return fosite.ErrNotFound
return fmt.Errorf("failed to marshal value: %w", err)
Copy link

Copilot AI Aug 19, 2025

Choose a reason for hiding this comment

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

Missing import for fmt package. The code uses fmt.Errorf but there's no visible import statement for the fmt package in the diff context.

Copilot uses AI. Check for mistakes.
@hrntknr hrntknr merged commit 92eb5d4 into main Aug 19, 2025
4 checks passed
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.

2 participants