Skip to content

fix: wrap lifecycle service errors with meaningful messages#487

Open
poyrazK wants to merge 1 commit intomainfrom
fix/lifecycle-error-wrapping
Open

fix: wrap lifecycle service errors with meaningful messages#487
poyrazK wants to merge 1 commit intomainfrom
fix/lifecycle-error-wrapping

Conversation

@poyrazK
Copy link
Copy Markdown
Owner

@poyrazK poyrazK commented May 7, 2026

Summary

Wrap lifecycle service errors with proper errors.Error type to ensure meaningful error messages are returned instead of generic "An unexpected error occurred".

Problem

When storage lifecycle set fails (e.g., bucket not found, database error), the CLI shows a generic "An unexpected error occurred" instead of a meaningful message. This is because repo errors are returned raw without wrapping in errors.Error type.

Solution

Wrap repository/service errors with errors.Wrap(errors.Internal, "meaningful context", err) in the service layer, following the pattern from other services like route_table.go and container.go.

Changes

internal/core/services/lifecycle_svc.go:

  • CreateRule: wrap storageRepo.GetBucket and repo.Create errors
  • ListRules: wrap storageRepo.GetBucket error
  • DeleteRule: wrap storageRepo.GetBucket, repo.Get, and repo.Delete errors

Verification

  • go build ./... passes
  • CI passes

Fixes #472

Return proper errors.Error type instead of raw repo errors to
ensure httputil.Error() returns meaningful messages instead of
generic "An unexpected error occurred".

Fixes #472
Copilot AI review requested due to automatic review settings May 7, 2026 18:19
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 7, 2026

Warning

Rate limit exceeded

@poyrazK has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 17 minutes and 32 seconds before requesting another review.

To continue reviewing without waiting, purchase usage credits in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ba629476-2d38-4555-88ec-67b4165fa34e

📥 Commits

Reviewing files that changed from the base of the PR and between 5faabcc and 3a36a0c.

📒 Files selected for processing (1)
  • internal/core/services/lifecycle_svc.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/lifecycle-error-wrapping

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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.

CLI storage lifecycle set returns INTERNAL error

2 participants