Errors¶
Nothing throws, so the SDK can't crash your app. Every call returns, and every error goes to the log and to a listener:
Swift
PlingBuddy.setErrorListener { error in
print("PlingBuddy \(error.code): \(error.message)")
}
A PlingBuddyError has a code, a message, the field it concerns if any, and transient.
- Errors that pass by themselves have
transientset, and the SDK sends again by itself: after the wait the service asked for, or after 30 seconds, doubling up to 15 minutes.
| Code | When |
|---|---|
unreachable |
No network, or a timeout. |
server_error |
A server error on the service. |
rate_limited |
The service asked the device to wait. |
access_denied |
A 401 or 403 from something between the device and the service, such as a proxy or firewall. |
- Everything else is usually a mistake to fix in the app:
| Code | When |
|---|---|
not_initialized |
A call before the first initialize. |
invalid_argument |
The app passed data that breaks a data rule; field names it. Nothing was stored. |
invalid_application |
The service doesn't know the application id. |
field_refused |
The service refused a field; field names it. A field the request carried was dropped; otherwise it's only named as possibly wrong. |
external_id_refused |
The service refused the external id; the user went back to the previous one. |
request_refused |
The service refused the request for another reason. The sync stops until the next initialize. |
setup_error |
The service keeps answering that the installation doesn't exist, for example because of a wrong baseUrl. The sync stops until the next initialize. |
identity_setup_error |
Identity tokens keep being refused, or none can be had. See identity verification on the Users and data page. |
identity_mismatch |
The identity token is for another user. |
identity_verification_required |
deleteRecipient for a signed-in user, while the application doesn't verify identities. Your backend has to erase the user another way. |
storage_error |
The SDK's state file can't be written, or a corrupt one was set aside. |
permission_error |
The platform failed while asking for permission or reading the push token. |
Errors never contain the device's credentials, push token or identity token.