Be more robust against load callback failures
Issue: #2795 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=174836960
This commit is contained in:
parent
f014b67d3e
commit
7f135f2cda
@ -380,7 +380,13 @@ public final class Loader implements LoaderErrorThrower {
|
|||||||
callback.onLoadCanceled(loadable, nowMs, durationMs, false);
|
callback.onLoadCanceled(loadable, nowMs, durationMs, false);
|
||||||
break;
|
break;
|
||||||
case MSG_END_OF_SOURCE:
|
case MSG_END_OF_SOURCE:
|
||||||
callback.onLoadCompleted(loadable, nowMs, durationMs);
|
try {
|
||||||
|
callback.onLoadCompleted(loadable, nowMs, durationMs);
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
// This should never happen, but handle it anyway.
|
||||||
|
Log.e(TAG, "Unexpected exception handling load completed", e);
|
||||||
|
fatalError = new UnexpectedLoaderException(e);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case MSG_IO_EXCEPTION:
|
case MSG_IO_EXCEPTION:
|
||||||
currentError = (IOException) msg.obj;
|
currentError = (IOException) msg.obj;
|
||||||
@ -392,6 +398,9 @@ public final class Loader implements LoaderErrorThrower {
|
|||||||
start(getRetryDelayMillis());
|
start(getRetryDelayMillis());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
// Never happens.
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user