Skip to content

Commit 1ce8741

Browse files
committed
Add dedicated internal initializer for MuxUpload error with unknown error code (#35)
1 parent abf3cbc commit 1ce8741

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

Sources/MuxUploadSDK/PublicAPI/MuxUpload.swift

+12-4
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,17 @@ public final class MuxUpload : Hashable, Equatable {
302302
}
303303
}
304304

305+
extension MuxUpload.UploadError {
306+
internal init(
307+
lastStatus: MuxUpload.Status
308+
) {
309+
self.lastStatus = lastStatus
310+
self.code = MuxErrorCase.unknown
311+
self.message = ""
312+
self.reason = nil
313+
}
314+
}
315+
305316
fileprivate struct InternalUploaderDelegate : ChunkedFileUploaderDelegate {
306317
let outerDelegate: (ChunkedFileUploader.InternalUploadState) -> Void
307318

@@ -363,10 +374,7 @@ extension Error {
363374
}
364375
} else {
365376
return MuxUpload.UploadError(
366-
lastStatus: lastSeenUploadStatus,
367-
code: MuxErrorCase.unknown,
368-
message: "unknown",
369-
reason: nil
377+
lastStatus: lastSeenUploadStatus
370378
)
371379
}
372380
}

0 commit comments

Comments
 (0)