genesluder / python-apns

A library for interacting with APNs using HTTP/2 and token-based authentication.
MIT License
90 stars 50 forks source link

Handling exceptions in bulk_send_message #7

Closed EmlynC closed 7 years ago

EmlynC commented 7 years ago

It makes sense to allow messages that can be sent to be sent as part of the for loop in bulk_send_message, however, it is still prudent to bubble up an exception. I suggest that you allow the loop to continue, collect all the registration ids that are bad and is all of them are bad raise a BadDeviceToken else if some fail return a new PartialBulkMessage exception which explains which ones have failed and binds the failed ids to the exception for further processing.

genesluder commented 7 years ago

Thanks for adding this! Sorry the delay in getting back.

EmlynC commented 7 years ago

Hey no worries, thanks for merging.