Skip to content

Network Error Handling

Network Error Management:

public void onFailure(AlphynCallbackResult result) {
if (result.isNetwork()) {
switch (result.getOriginalEventType()) {
case NETWORK_ERROR:
Log.e("Network", "🌐 Network connectivity error");
handleNetworkConnectivityIssue();
break;
case REQUEST_FAILED:
Log.e("Network", "📡 API request failed");
handleAPIRequestFailure(result);
break;
case AUTH_FAILED:
Log.e("Network", "🔐 Authentication failed");
handleAuthenticationFailure();
break;
}
}
}
private void handleNetworkConnectivityIssue() {
// Implement retry logic with exponential backoff
scheduleNetworkRetry();
}
private void handleAPIRequestFailure(AlphynCallbackResult result) {
// Parse error details and implement appropriate response
String errorDetails = result.getDetails();
Log.w("Network", "Request failed: " + errorDetails);
}