Error Handling
Standardized error codes across all Abrova Push SDKs — connection (1000s), subscription (1100s), message (1200s), registration (1400s), permission (1600s). Handler examples for Flutter and Web.
Handle errors gracefully with detailed error codes. All SDKs use standardized numeric error codes for consistent error handling across platforms.
Connection Errors (1000-1099)#
| Code | Name | Description |
|---|---|---|
| 1000 | CONNECTION_FAILED | Failed to connect to server |
| 1001 | CONNECTION_TIMEOUT | Connection timed out |
| 1002 | CONNECTION_LOST | Connection to server was lost |
| 1003 | CONNECTION_REFUSED | Connection was refused by server |
| 1004 | AUTHENTICATION_FAILED | Invalid credentials or API key |
| 1005 | SSL_ERROR | SSL/TLS handshake failed |
| 1006 | BROKER_UNAVAILABLE | Server is unavailable |
Subscription Errors (1100-1199)#
| Code | Name | Description |
|---|---|---|
| 1100 | SUBSCRIPTION_FAILED | Failed to subscribe to topic |
| 1101 | UNSUBSCRIPTION_FAILED | Failed to unsubscribe from topic |
| 1102 | INVALID_TOPIC | Invalid topic format |
Message Errors (1200-1299)#
| Code | Name | Description |
|---|---|---|
| 1200 | MESSAGE_DELIVERY_FAILED | Failed to deliver message |
| 1201 | MESSAGE_PARSE_ERROR | Failed to parse message payload |
| 1202 | MESSAGE_TIMEOUT | Message delivery timed out |
Configuration Errors (1300-1399)
| Code | Name | Description |
|---|---|---|
| 1300 | INVALID_CONFIG | Invalid configuration |
| 1301 | MISSING_API_KEY | API key is missing |
| 1302 | MISSING_SERVER_URL | Server URL is missing |
| 1303 | INVALID_CREDENTIALS | Invalid connection credentials |
| 1304 | CONFIGURATION_FAILED | Failed to fetch configuration from server (Android, Flutter) |
Registration Errors (1400-1499)#
| Code | Name | Description |
|---|---|---|
| 1400 | REGISTRATION_FAILED | Device registration failed |
| 1401 | DEVICE_ID_GENERATION_FAILED | Failed to generate device ID |
| 1402 | SERVER_ERROR | Server returned an error |
| 1403 | NETWORK_ERROR | Network request failed |
State Errors (1500-1599)
| Code | Name | Description |
|---|---|---|
| 1500 | NOT_INITIALIZED | SDK is not initialized |
| 1501 | NOT_CONNECTED | Not connected to server |
| 1502 | ALREADY_CONNECTED | Already connected to server |
| 1503 | SERVICE_NOT_RUNNING | Background service (Web: service worker) is not running |
| 9999 | UNKNOWN_ERROR | An unknown error occurred |
Permission Errors (1600-1699)#
Web SDK only. Android and Flutter define no 1600 codes; on iOS, 1600 / 1601 are the A/B testing errors variantNotFound / testNotFound.
| Code | Name | Description |
|---|---|---|
| 1600 | PERMISSION_DENIED | Notification permission denied |
| 1601 | PERMISSION_DISMISSED | User dismissed permission prompt |
Flutter#
AbrovaPush.onDetailedError((error) async {
switch (error.errorCode) {
case AbrovaPushErrorCode.connectionFailed:
// Show "Connection failed" message
// SDK will auto-retry
break;
case AbrovaPushErrorCode.authenticationFailed:
// Invalid API key - check dashboard
break;
case AbrovaPushErrorCode.registrationFailed:
// Retry registration
await AbrovaPush.register(userId: userId);
break;
case AbrovaPushErrorCode.subscriptionFailed:
// Topic subscription failed
break;
case AbrovaPushErrorCode.networkError:
// Show offline indicator
// SDK will reconnect when network returns
break;
default:
print('Error: ${error.message}');
}
});Web#
import { AbrovaPushErrorCode } from '@abrova/push-web';
abrovaPush.onDetailedError((error) => {
switch (error.code) {
case AbrovaPushErrorCode.CONNECTION_FAILED:
// Show "Connection failed" message — SDK auto-retries
break;
case AbrovaPushErrorCode.AUTHENTICATION_FAILED:
// Invalid API key — check dashboard
break;
case AbrovaPushErrorCode.REGISTRATION_FAILED:
// Retry registration
abrovaPush.register({ userId });
break;
case AbrovaPushErrorCode.SUBSCRIPTION_FAILED:
// Topic subscription failed
break;
case AbrovaPushErrorCode.NETWORK_ERROR:
// Show offline indicator — SDK reconnects when network returns
break;
case AbrovaPushErrorCode.PERMISSION_DENIED:
// User denied notification permission
showPermissionRequestUI();
break;
default:
console.error('Error:', error.code, error.message, error.details);
}
});Simple Error Handler#
For projects that just need to log errors without branching:
AbrovaPush.onError((error) {
// Log to crash reporting
FirebaseCrashlytics.instance.recordError(
Exception(error),
null,
reason: 'AbrovaPush error',
);
});Best Practices#
Register onError / onDetailedError before calling any other SDK methods
Forward errors to Crashlytics / Sentry for debugging production issues
Translate technical error codes into messages users can understand
The SDK auto-retries most errors — let it work
Show an offline indicator instead of treating it as a hard failure