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

Better Error handling for empty token list in Messaging send_each_multicast #792

Open
Alick1997 opened this issue Jun 17, 2024 · 1 comment

Comments

@Alick1997
Copy link

Alick1997 commented Jun 17, 2024

Problem
Non-descriptive error message returned when sending multicast message with empty device token list. Currently the empty list of tokens propagates throughout the code and results in an Unknown Error type with a vague error message as follows: "Unknown error while making remote service calls: max_workers must be greater than 0". This error seems to originate here as the Threadpool is created with max_workers based on the length of the messages parameter, which is ultimately dependent on the number of tokens in the Message object.

Describe the solution you'd like
Check the length of device tokens directly in the send_each_multicast method and return a descriptive ValueError in the event of an empty list. here

Describe alternatives you've considered
Check the length of the message directly in the send_each class method here.

@google-oss-bot
Copy link

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants