diff --git a/Sources/tart/VMDirectory+OCI.swift b/Sources/tart/VMDirectory+OCI.swift index 04e1922a..c09e0986 100644 --- a/Sources/tart/VMDirectory+OCI.swift +++ b/Sources/tart/VMDirectory+OCI.swift @@ -1,3 +1,4 @@ +import Compression import Foundation import Sentry @@ -53,8 +54,13 @@ extension VMDirectory { let progress = Progress(totalUnitCount: diskCompressedSize) ProgressObserver(progress).log(defaultLogger) - try await diskImplType.pull(registry: registry, diskLayers: layers, diskURL: diskURL, concurrency: concurrency, progress: progress, - localLayerCache: localLayerCache) + do { + try await diskImplType.pull(registry: registry, diskLayers: layers, diskURL: diskURL, + concurrency: concurrency, progress: progress, + localLayerCache: localLayerCache) + } catch let error where error is FilterError { + throw RuntimeError.PullFailed("failed to decompress disk: \(error.localizedDescription)") + } // Pull VM's NVRAM file layer and store it in an NVRAM file defaultLogger.appendNewLine("pulling NVRAM...") diff --git a/Sources/tart/VMStorageHelper.swift b/Sources/tart/VMStorageHelper.swift index c4ecc9ce..cf2ab22d 100644 --- a/Sources/tart/VMStorageHelper.swift +++ b/Sources/tart/VMStorageHelper.swift @@ -69,6 +69,7 @@ enum RuntimeError : Error { case OCIStorageError(_ message: String) case OCIUnsupportedDiskFormat(_ format: String) case SuspendFailed(_ message: String) + case PullFailed(_ message: String) } protocol HasExitCode { @@ -122,6 +123,8 @@ extension RuntimeError : CustomStringConvertible { return "OCI disk format \(format) is not supported by this version of Tart" case .SuspendFailed(let message): return "Failed to suspend the VM: \(message)" + case .PullFailed(let message): + return message } } }