I'm using Firebase to download files on Android. Here is my code:
try {
//.. Try to download file from Firebase
} catch(StorageException e) {
if(e.getErrorCode() == StorageException.ERROR_RETRY_LIMIT_EXCEEDED) {
//Ignore! Exception has occurred due to no Internet availability
} else {
//Other genuine failure, log it
Crashlytics.logException(e);
}
}
Now, this code does not send "The operation retry limit has been exceeded." exception. However, in Crashlytics I'm still able to see this exception being reported.
Non-fatal Exception: com.google.firebase.storage.StorageException
The operation retry limit has been exceeded.
Caused by javax.net.ssl.SSLException
Read error: ssl=0x7188e1fe08: I/O error during system call, Software caused connection abort
How is this possible? Am I missing anything?
Firebase version: 16.0.1
Your post does not show the code for the file download. I'll assume it has a completion listener on the Task
. Maybe the exception does not propagate out to an enclosing try-block
and you need to handle it in the callback, as shown here:
storageRef.getFile(contentDir).addOnCompleteListener(
new OnCompleteListener<FileDownloadTask.TaskSnapshot>() {
@Override
public void onComplete(@NonNull Task<FileDownloadTask.TaskSnapshot> task) {
if (task.isSuccessful()) {
...
} else {
StorageException se = (StorageException) task.getException();
if (se.getErrorCode() == StorageException.ERROR_RETRY_LIMIT_EXCEEDED) {
// Ignore
} else {
Crashlytics.logException(se);
}
}
}
});
If I guessed wrong on your download code, please update your post to include it.
There's no guarantee that the StorageException's error code is being set or being set correctly in all cases for ERROR_RETRY_LIMIT_EXCEEDED errors and likely your check fails because of that. Basically, someone in Firebase code has a bug where they just fail to set the error_code correctly (or sets it to a different value) but the error message is set correctly, so when you print the error it looks like you would expect other than the error_code value. If you can reproduce the error set a break point or add more logging of the exception values so you can see what the error_code is when the check fails. Try adding another check that parses the error message as a backup for cases where error_code is wrong.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With