Skip to content

Commit

Permalink
Be more robust against load callback failures
Browse files Browse the repository at this point in the history
Issue: #2795

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=174836960
  • Loading branch information
ojw28 committed Nov 13, 2017
1 parent 065091c commit 3472eda
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,13 @@ public void handleMessage(Message msg) {
callback.onLoadCanceled(loadable, nowMs, durationMs, false);
break;
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;
case MSG_IO_EXCEPTION:
currentError = (IOException) msg.obj;
Expand All @@ -392,6 +398,9 @@ public void handleMessage(Message msg) {
start(getRetryDelayMillis());
}
break;
default:
// Never happens.
break;
}
}

Expand Down

0 comments on commit 3472eda

Please sign in to comment.