novoda / download-manager

A library that handles long-running downloads, handling the network interactions and retrying downloads automatically after failures
Apache License 2.0
483 stars 63 forks source link

DLM-466/File Size Requester Error #482

Closed Mecharyry closed 5 years ago

Mecharyry commented 5 years ago

Problem

As per the issues #458, #466 errors can occur when attempting to determine a files size but these are not propagated to the download-manager in a meaningful way. At the moment any errors result in a 0 size. This size is then determined to be unknown which then is translated into a network error which automatically schedules a retry, but it might not be something we can recover from 😬

Solution

Introduce a FileSizeResult that represents either a FileSize or a String errorMessage. All calls to check the size that should result in a meaningful failure now emit an error status, instead of being transformed to a network error.