From c825ba4cb19d12d688c23780a17001b60406fbec Mon Sep 17 00:00:00 2001 From: Fedor Korotkov Date: Tue, 3 Dec 2024 06:52:40 -0500 Subject: [PATCH] Better message if hardware model is not supported by the host (#962) Related to https://github.com/cirruslabs/tart/discussions/961 It seems `VZMacHardwareModel #init?(dataRepresentation: Data)` is nullable sometimes. Let's return a better message in this case. --- Sources/tart/Platform/Darwin.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/tart/Platform/Darwin.swift b/Sources/tart/Platform/Darwin.swift index 7145810..8f05890 100644 --- a/Sources/tart/Platform/Darwin.swift +++ b/Sources/tart/Platform/Darwin.swift @@ -38,7 +38,7 @@ struct UnsupportedHostOSError: Error, CustomStringConvertible { throw DecodingError.dataCorruptedError(forKey: .hardwareModel, in: container, debugDescription: "") } guard let hardwareModel = VZMacHardwareModel.init(dataRepresentation: data) else { - throw DecodingError.dataCorruptedError(forKey: .hardwareModel, in: container, debugDescription: "") + throw UnsupportedHostOSError() } self.hardwareModel = hardwareModel }