diff --git a/lib/core/utils/sync/icloud.dart b/lib/core/utils/sync/icloud.dart index fb5d3187..2f67d650 100644 --- a/lib/core/utils/sync/icloud.dart +++ b/lib/core/utils/sync/icloud.dart @@ -71,20 +71,25 @@ abstract final class ICloud { String? localPath, }) async { final completer = Completer(); - await ICloudStorage.download( - containerId: _containerId, - relativePath: relativePath, - destinationFilePath: localPath ?? '${await Paths.doc}/$relativePath', - onProgress: (stream) { - stream.listen( - null, - onDone: () => completer.complete(null), - onError: (e) => completer.complete( - ICloudErr(type: ICloudErrType.generic, message: '$e'), - ), - ); - }, - ); + try { + await ICloudStorage.download( + containerId: _containerId, + relativePath: relativePath, + destinationFilePath: localPath ?? '${await Paths.doc}/$relativePath', + onProgress: (stream) { + stream.listen( + null, + onDone: () => completer.complete(null), + onError: (e) => completer.complete( + ICloudErr(type: ICloudErrType.generic, message: '$e'), + ), + ); + }, + ); + } catch (e, s) { + _logger.warning('Download $relativePath failed', e, s); + completer.complete(ICloudErr(type: ICloudErrType.generic, message: '$e')); + } return completer.future; }