Skip to content

Commit 018ff5b

Browse files
committed
TUS: Also log actual retry error
1 parent 70efb55 commit 018ff5b

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

opencloudApp/src/main/java/eu/opencloud/android/workers/TusUploadHelper.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,11 +326,15 @@ class TusUploadHelper(
326326
Timber.w("TUS: offset recovery failed (recovered=%s, current=%d)", recoveredOffset, offset)
327327
}
328328

329-
// Check if we've exhausted retries
329+
// Check if we've exhausted retries. This retry loop is meant for transient
330+
// network failures; local read errors (e.g. cache file deleted mid-upload)
331+
// also end up here, but since the request body propagates them (PR #157)
332+
// patchResult.exception carries the real cause — chain it so the final
333+
// failure doesn't blame the network for a local problem.
330334
if (consecutiveFailures >= MAX_RETRIES) {
331335
throw java.io.IOException(
332-
"TUS: giving up after $MAX_RETRIES retries at offset $offset (network error)",
333-
IllegalStateException("TUS: max retries exceeded")
336+
"TUS: giving up after $MAX_RETRIES retries at offset $offset",
337+
patchResult.exception ?: IllegalStateException("TUS: max retries exceeded")
334338
)
335339
}
336340

0 commit comments

Comments
 (0)