Skip to content

fix: wrap container service errors with meaningful messages#480

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

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

Conversation

@poyrazK
Copy link
Copy Markdown
Owner

@poyrazK poyrazK commented May 7, 2026

Summary

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

Problem

When container deploy (or other container operations) fail, the API returns a raw database error that httputil.Error() doesn't recognize. It defaults to INTERNAL error with "An unexpected error occurred".

Solution

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

Changes

internal/core/services/container.go:

  • CreateDeployment: wrap repo.CreateDeployment error
  • GetDeployment: wrap repo.GetDeploymentByID error
  • ScaleDeployment: wrap repo.GetDeploymentByID and repo.UpdateDeployment errors
  • DeleteDeployment: wrap repo.GetDeploymentByID and repo.UpdateDeployment errors

Verification

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

Fixes #455

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 #455
Copilot AI review requested due to automatic review settings May 7, 2026 16:44
@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 49 minutes and 44 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: a891f0b5-b1e7-4ea6-b5a1-14bab81a1a6b

📥 Commits

Reviewing files that changed from the base of the PR and between f6ac71f and 42661b6.

📒 Files selected for processing (1)
  • internal/core/services/container.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/container-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 container deploy returns INTERNAL error instead of meaningful error

2 participants