When the TUSClientDelegate receives a fileError callback, the id is not provided, making it difficult to know which upload may have thrown the error and may need to be retried. fileError can be called for non-upload-specific uploads, so I would propose providing an optional id in cases where it is known and can be attributed to a specific upload.
protocol TUSClientDelegate {
/// Receive an error related to files. E.g. The `TUSClient` couldn't store a file or remove a file.
func fileError(id: String?, error: TUSClientError, client: TUSClient)
}
In SchedulerDelegate:
func onError(error: Error, task: ScheduledTask, scheduler: Scheduler) {
...
do {
try files.encodeAndStore(metaData: metaData)
} catch let error {
let tusError = TUSClientError.couldNotStoreFileMetadata(underlyingError: error)
reportingQueue.async {
- self.delegate?.fileError(error: tusError, client: self)
+ self.delegate?.fileError(id: metaData.id, error: tusError, client: self)
}
}
...
When the TUSClientDelegate receives a
fileErrorcallback, theidis not provided, making it difficult to know which upload may have thrown the error and may need to be retried.fileErrorcan be called for non-upload-specific uploads, so I would propose providing an optionalidin cases where it is known and can be attributed to a specific upload.In SchedulerDelegate: