-
Notifications
You must be signed in to change notification settings - Fork 1
fix: handle 404 errors on list grants for schedules #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Wrap 404 errors from OpsGenie API with codes.NotFound so baton-sdk can handle these as warnings instead of errors. This prevents sync failures when a schedule is deleted or renamed in OpsGenie. Fixes: CX-512
WalkthroughAdds handling for 404 Not Found responses from the OpsGenie GetOnCalls call in the schedule grants flow, mapping such cases to a gRPC NotFound status with a descriptive message instead of a generic error. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@pkg/connector/schedule.go`:
- Around line 206-210: The current direct type assertion on err to
*ogClient.ApiError in the schedule handling code can miss wrapped errors; import
the "errors" package and replace the assertion with errors.As to unwrap and test
for *ogClient.ApiError (e.g., declare a var apiErr *ogClient.ApiError and call
errors.As(err, &apiErr) ), and if true and apiErr.StatusCode ==
http.StatusNotFound return the same status.Error(codes.NotFound,
fmt.Sprintf(...)) so wrapped ApiError instances are correctly detected; update
imports to include "errors".
Replace direct type assertion with errors.As to correctly detect wrapped *ogClient.ApiError instances when checking for 404 errors.
Wrap 404 errors from OpsGenie API with codes.NotFound so baton-sdk can handle these as warnings instead of errors. This prevents sync failures when a schedule is deleted or renamed in OpsGenie.
Fixes: CX-512
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.