From 6b5c288a407e8b8f60320141924d182f2676c917 Mon Sep 17 00:00:00 2001 From: Brandon Evans Date: Fri, 22 Jan 2021 22:19:15 -0700 Subject: [PATCH] Unwrap auth error messages to avoid "Optional(...)" --- Xcodes/Backend/HelperClient.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Xcodes/Backend/HelperClient.swift b/Xcodes/Backend/HelperClient.swift index 75b4ef3..e917900 100644 --- a/Xcodes/Backend/HelperClient.swift +++ b/Xcodes/Backend/HelperClient.swift @@ -337,7 +337,11 @@ final class HelperClient { private func executeAuthorizationFunction(_ authorizationFunction: () -> (OSStatus) ) throws { let osStatus = authorizationFunction() guard osStatus == errAuthorizationSuccess else { - throw HelperClientError.message(String(describing: SecCopyErrorMessageString(osStatus, nil))) + if let message = SecCopyErrorMessageString(osStatus, nil) { + throw HelperClientError.message(String(message as NSString)) + } else { + throw HelperClientError.message("Unknown error") + } } }