@@ -229,14 +229,14 @@ enum StorageMultipartUpload {
229229 case . parts( let uploadId, let uploadFile, let partSize, let parts) :
230230 self = . paused( uploadId: uploadId, uploadFile: uploadFile, partSize: partSize, parts: parts)
231231 default :
232- throw Failure . invalidStateTransition ( reason: " Cannot pause from current state: \( self ) " )
232+ throw Failure . invalidStateTransition ( reason: " Cannot pause upload: upload must be in progress " )
233233 }
234234 case . resuming:
235235 switch self {
236236 case . paused( let uploadId, let uploadFile, let partSize, let parts) :
237237 self = . parts( uploadId: uploadId, uploadFile: uploadFile, partSize: partSize, parts: parts)
238238 default :
239- throw Failure . invalidStateTransition ( reason: " Cannot resume from current state: \( self ) " )
239+ throw Failure . invalidStateTransition ( reason: " Cannot resume upload: upload must be paused " )
240240 }
241241 break
242242 case . completing( let taskIdentifier) :
@@ -246,20 +246,20 @@ enum StorageMultipartUpload {
246246 case . parts:
247247 self = . completed( uploadId: uploadId)
248248 default :
249- throw Failure . invalidStateTransition ( reason: " Cannot complete from current state: \( self ) " )
249+ throw Failure . invalidStateTransition ( reason: " Cannot complete upload: upload must be in progress " )
250250 }
251251 case . aborting( let error) :
252252 if let uploadId = uploadId {
253253 self = . aborting( uploadId: uploadId, error: error)
254254 } else {
255- throw Failure . invalidStateTransition ( reason: " Cannot abort from current state: \( self ) " )
255+ throw Failure . invalidStateTransition ( reason: " Cannot abort upload: no upload ID available " )
256256 }
257257 case . aborted( let uploadId, let error) :
258258 switch self {
259259 case . created, . parts, . aborting:
260260 self = . aborted( uploadId: uploadId, error: error)
261261 default :
262- throw Failure . invalidStateTransition ( reason: " Cannot abort from current state: \( self ) " )
262+ throw Failure . invalidStateTransition ( reason: " Cannot abort upload: upload must be in progress or created " )
263263 }
264264 case . failed( let uploadId, let error) :
265265 switch self {
@@ -268,7 +268,7 @@ enum StorageMultipartUpload {
268268 case . parts( _, _, _, let parts) :
269269 self = . failed( uploadId: uploadId, parts: parts, error: error)
270270 default :
271- throw Failure . invalidStateTransition ( reason: " Cannot fail from current state: \( self ) " )
271+ throw Failure . invalidStateTransition ( reason: " Cannot fail upload: invalid state for failure " )
272272 }
273273 }
274274 }
@@ -277,7 +277,7 @@ enum StorageMultipartUpload {
277277 mutating func transition( uploadPartEvent: StorageUploadPartEvent ) throws {
278278 guard !isAborting, !isAborted else { return }
279279 guard case . parts( let uploadId, let uploadFile, let partSize, var parts) = self else {
280- throw Failure . invalidStateTransition ( reason: " Parts are required for this transition: \( uploadPartEvent ) " )
280+ throw Failure . invalidStateTransition ( reason: " Cannot process part event: upload must be in progress " )
281281 }
282282
283283 let partNumber = uploadPartEvent. number
@@ -297,12 +297,12 @@ enum StorageMultipartUpload {
297297 parts [ index] = . inProgress( bytes: part. bytes, bytesTransferred: 0 , taskIdentifier: taskIdentifier)
298298 case . progressUpdated( _, let bytesTransferred, _) :
299299 guard case . inProgress( let bytes, _, let taskIdentifier) = part else {
300- throw Failure . invalidStateTransition ( reason: " Part cannot update progress in current state: \( self ) " )
300+ throw Failure . invalidStateTransition ( reason: " Cannot update progress: part must be in progress " )
301301 }
302302 parts [ index] = . inProgress( bytes: bytes, bytesTransferred: bytesTransferred, taskIdentifier: taskIdentifier)
303303 case . completed( _, let eTag, _) :
304304 guard case . inProgress( let bytes, _, _) = part else {
305- throw Failure . invalidStateTransition ( reason: " Part cannot be completed in current state: \( self ) " )
305+ throw Failure . invalidStateTransition ( reason: " Cannot complete part: part must be in progress " )
306306 }
307307 parts [ index] = StorageUploadPart . completed ( bytes: bytes, eTag: eTag)
308308 case . failed:
0 commit comments