executeUploadOrThrow<T> static method
Future<T>
executeUploadOrThrow<T>(
- List<
YKInterceptor> interceptors, - int maxRetries,
- YKNetworkingRequest request, {
- int retryCount = 0,
- Set<
String> ? retrySkipNames,
Throwing variant of executeUpload.
Returns T directly on success, throws YKNetworkException on failure
or cancellation.
Implementation
static Future<T> executeUploadOrThrow<T>(
List<YKInterceptor> interceptors,
int maxRetries,
YKNetworkingRequest request, {
int retryCount = 0,
Set<String>? retrySkipNames,
}) async {
final result = await executeUpload<T>(interceptors, maxRetries, request,
retryCount: retryCount, retrySkipNames: retrySkipNames);
switch (result) {
case YKSuccess(:final data):
return data;
case YKFailure(:final exception):
throw exception;
case YKCancelled(:final reason):
throw YKNetworkException(type: YKErrorType.cancelled, message: reason);
}
}