genesluder / python-apns

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

send_bulk_message needs more refined error handling #18

Open MrCsabaToth opened 6 years ago

MrCsabaToth commented 6 years ago

Right now send_bulk_message can emit BadDeviceToken and a PartialBulkMessage exceptions. When filling the good_registration_ids and bad_registration_ids the exception is pac-man style (catch all) and doesn't really distinguish between various types of errors. Only those 403 TokenError and 410 TokenInactive should be considered as id problems. Otherwise the user's APNs server will inactivate such device tokens which are still valid!

MrCsabaToth commented 6 years ago

There could be a way to catch and provide the exceptions along with the bad ids, so there won't be a need for extra rounds with send_message