From 978bb28664b4ac4eb823110281c1365fc20af3d2 Mon Sep 17 00:00:00 2001 From: Tristan Labelle Date: Tue, 22 Oct 2024 17:09:49 -0400 Subject: [PATCH] Fix superfluous try/catch causing build error --- swiftwinrt/Resources/Support/Error.swift | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/swiftwinrt/Resources/Support/Error.swift b/swiftwinrt/Resources/Support/Error.swift index 5ab1d63a..4ae1a98a 100644 --- a/swiftwinrt/Resources/Support/Error.swift +++ b/swiftwinrt/Resources/Support/Error.swift @@ -180,12 +180,11 @@ public func failWith(error: Swift.Error) -> HRESULT { hresult = winrtError.hr } - do { - try message.withHStringRef { - _ = RoOriginateLanguageException(hresult, $0, nil) - } - } catch { - _ = RoOriginateLanguageException(hresult, nil, nil) + message.withHStringRef { + // Returns false if the string is empty or hresult is success, + // in which case there isn't more info to associate with the + // returned hresult. + _ = RoOriginateLanguageException(hresult, $0, nil) } return hresult