fix: wrap container service errors with meaningful messages#480
fix: wrap container service errors with meaningful messages#480
Conversation
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
|
Warning Rate limit exceeded
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 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 configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Summary
Wrap container service errors with proper
errors.Errortype 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 thathttputil.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 likeroute_table.go.Changes
internal/core/services/container.go:repo.CreateDeploymenterrorrepo.GetDeploymentByIDerrorrepo.GetDeploymentByIDandrepo.UpdateDeploymenterrorsrepo.GetDeploymentByIDandrepo.UpdateDeploymenterrorsVerification
go build ./...passesFixes #455