-
Notifications
You must be signed in to change notification settings - Fork 9
fix(apns): handling of the certificate expiration error #364
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
// Note: Should we pass this error back up? | ||
Err(_e) => None, | ||
}; | ||
let public_ip = networking::find_public_ip_addr().ok(); |
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.
Fixing clippy error.
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.
Pull Request Overview
This PR introduces handling for APNS CertificateExpired
errors and simplifies public IP lookup.
- Simplify
public_ip
assignment by using.ok()
- Add a new match arm for
CertificateExpired
in the APNS provider
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
src/state.rs | Replace manual match with .ok() for public IP |
src/providers/apns.rs | Add explicit handling for CertificateExpired alerts |
Comments suppressed due to low confidence (3)
src/providers/apns.rs:178
- [nitpick] Using
dbg
as a variable name can be confused with thedbg!
macro. Rename this binding to something more descriptive, likedebug_msg
.
dbg if dbg.contains("received fatal alert: CertificateExpired") => {
src/providers/apns.rs:175
- New error variant
ApnsCertificateExpired
is introduced but there are no tests for this branch. Consider adding a unit test that simulates theCertificateExpired
response.
impl PushProvider for ApnsProvider {
src/providers/apns.rs:179
- The
client_error
identifier isn't in scope here and named placeholders aren't supported byinfo!
. You likely need to reference the correct error variable and use{}
formatting with positional arguments.
info!("APNs certificate expired: debug:{dbg}, display: {client_error}");
// Note: Should we pass this error back up? | ||
Err(_e) => None, | ||
}; | ||
let public_ip = networking::find_public_ip_addr().ok(); |
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.
Silently ignoring errors from find_public_ip_addr
may make debugging harder. Consider logging the error at debug or warn level before calling .ok()
.
Copilot uses AI. Check for mistakes.
Description
This PR adds proper handling of the
received fatal alert: CertificateExpired
APNS error.How Has This Been Tested?
Not tested.
Due Diligence