Skip to content
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

Catch and handle errors of FCM #2805

Merged
merged 1 commit into from
May 25, 2024
Merged

Catch and handle errors of FCM #2805

merged 1 commit into from
May 25, 2024

Conversation

MizukiTemma
Copy link
Member

@MizukiTemma MizukiTemma commented May 16, 2024

Short description

This PR add an error handling for invalid FCM URL.

update
This takes care of timeout exception too. I've totally forgotten that those two issues are related each other.

Proposed changes

  • Catch errors and show an error message to users
  • The error message is left universal (not specific to any error type) because many types are possible.

Side effects

  • The rendering after failing of a push notification is partially broken.
  • A question regarding this rendering: don't we want to redirect not no the create view but to the edit view becuase the push notification is saved in this case?
  • I'll suggest to fix the rendering in a separate PR/issue.

Resolved issues

Fixes: #2025 , #2790


Pull Request Review Guidelines

@MizukiTemma MizukiTemma requested a review from a team as a code owner May 16, 2024 11:13
Copy link

codeclimate bot commented May 16, 2024

Code Climate has analyzed commit b19104e and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 15.3% (50% is the threshold).

This pull request will bring the total coverage in the repository to 82.2% (0.0% change).

View more on Code Climate.

@MizukiTemma MizukiTemma changed the title Catch and handle error of wrong FCM URL Catch and handle errors of FCM May 16, 2024
@MizukiTemma MizukiTemma force-pushed the bug/wrong_fcm_url branch 3 times, most recently from 900953e to d1f3ada Compare May 16, 2024 17:55
Copy link
Member

@david-venhoff david-venhoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this fixes both linked issues.
I think, as part of the clean code initiative, we should avoid introducing new pylint: disable= comments. Maybe one option would be to handle the errors directly at self.send_pn

@MizukiTemma
Copy link
Member Author

@david-venhoff
That's a nice idea 😸 Applied!

Copy link
Member

@david-venhoff david-venhoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice :)

Copy link
Member

@ulliholtgrave ulliholtgrave left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this extra handling 👍

@MizukiTemma MizukiTemma merged commit 41ace07 into develop May 25, 2024
5 checks passed
@MizukiTemma MizukiTemma deleted the bug/wrong_fcm_url branch May 25, 2024 13:13
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.

Improve FCM API Error handling
3 participants