This diff introduces changes to the A2 (APNs) library wrapper and apns_status shared enum.
To distinguish common errors and wrong/expired device token errors the function should return different results.
Following a current keyserver's approach we should check for the following errors:
- We should not check for HTTP status code other than 200 for success, it's already done inside the A2 library.
- We should check for ErrorReason of Unregistered which is similar to the keyserver's apnTokenInvalidationErrorCode.
- We should check for ErrorReason of BadDeviceToken which is similar to the keyserver's apnBadTokenErrorString.
To pass the different errors to the C++ level the best and most elegant way is to return enum as Ok Rust result which formats like:
enum apns_status { Ok, Unregistered, BadDeviceToken, }
and use CXX shared types.
Because when can't distinguish error types from Rust on the C++ side, they are always rust::error type and have only what() method.
Also, we will catch the common errors which are not needed to be distinguished using the catch approach.
Related Linear task: ENG-1764