Skip to content

TUSClientDelegate.fileError should include optional upload identifier #215

Description

@cwalo

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)
            }
        }
...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions