Commit ad699b8f by olly Committed by Oliver Woodman

seenCacheError should be set for all errors

PiperOrigin-RevId: 265662686
parent c3d6be3a
...@@ -283,7 +283,7 @@ public final class CacheDataSource implements DataSource { ...@@ -283,7 +283,7 @@ public final class CacheDataSource implements DataSource {
} }
openNextSource(false); openNextSource(false);
return bytesRemaining; return bytesRemaining;
} catch (IOException e) { } catch (Throwable e) {
handleBeforeThrow(e); handleBeforeThrow(e);
throw e; throw e;
} }
...@@ -325,6 +325,9 @@ public final class CacheDataSource implements DataSource { ...@@ -325,6 +325,9 @@ public final class CacheDataSource implements DataSource {
} }
handleBeforeThrow(e); handleBeforeThrow(e);
throw e; throw e;
} catch (Throwable e) {
handleBeforeThrow(e);
throw e;
} }
} }
...@@ -349,7 +352,7 @@ public final class CacheDataSource implements DataSource { ...@@ -349,7 +352,7 @@ public final class CacheDataSource implements DataSource {
notifyBytesRead(); notifyBytesRead();
try { try {
closeCurrentSource(); closeCurrentSource();
} catch (IOException e) { } catch (Throwable e) {
handleBeforeThrow(e); handleBeforeThrow(e);
throw e; throw e;
} }
...@@ -516,7 +519,7 @@ public final class CacheDataSource implements DataSource { ...@@ -516,7 +519,7 @@ public final class CacheDataSource implements DataSource {
} }
} }
private void handleBeforeThrow(IOException exception) { private void handleBeforeThrow(Throwable exception) {
if (isReadingFromCache() || exception instanceof CacheException) { if (isReadingFromCache() || exception instanceof CacheException) {
seenCacheError = true; seenCacheError = true;
} }
......
...@@ -359,7 +359,7 @@ public final class CacheUtil { ...@@ -359,7 +359,7 @@ public final class CacheUtil {
} }
} }
/*package*/ static boolean isCausedByPositionOutOfRange(IOException e) { /* package */ static boolean isCausedByPositionOutOfRange(IOException e) {
Throwable cause = e; Throwable cause = e;
while (cause != null) { while (cause != null) {
if (cause instanceof DataSourceException) { if (cause instanceof DataSourceException) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment