fix: wrap lifecycle service errors with meaningful messages#487
fix: wrap lifecycle service errors with meaningful messages#487
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 #472
|
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 lifecycle service errors with proper
errors.Errortype to ensure meaningful error messages are returned instead of generic "An unexpected error occurred".Problem
When
storage lifecycle setfails (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 inerrors.Errortype.Solution
Wrap repository/service errors with
errors.Wrap(errors.Internal, "meaningful context", err)in the service layer, following the pattern from other services likeroute_table.goandcontainer.go.Changes
internal/core/services/lifecycle_svc.go:storageRepo.GetBucketandrepo.CreateerrorsstorageRepo.GetBucketerrorstorageRepo.GetBucket,repo.Get, andrepo.DeleteerrorsVerification
go build ./...passesFixes #472