From d898884ddb06b12212ce23ca199ffb977be5796f Mon Sep 17 00:00:00 2001 From: Jamil Date: Tue, 21 Jan 2025 21:31:21 -0800 Subject: [PATCH] refactor(apple): Downgrade `noIPCData` to warning for logs (#7813) If the system extension has not been enabled by the user, opening the `Settings -> Diagnostic Logs` pane will trigger this error. There's nothing we can do until they enable the system extension, so don't capture this particular case in Sentry. --- .../Sources/FirezoneKit/Views/SettingsView.swift | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/swift/apple/FirezoneKit/Sources/FirezoneKit/Views/SettingsView.swift b/swift/apple/FirezoneKit/Sources/FirezoneKit/Views/SettingsView.swift index 189f6427f..062ab2241 100644 --- a/swift/apple/FirezoneKit/Sources/FirezoneKit/Views/SettingsView.swift +++ b/swift/apple/FirezoneKit/Sources/FirezoneKit/Views/SettingsView.swift @@ -92,7 +92,13 @@ public final class SettingsViewModel: ObservableObject { return byteCountFormatter.string(fromByteCount: Int64(totalSize)) } catch { - Log.error(error) + if let error = error as? VPNConfigurationManagerError, + case VPNConfigurationManagerError.noIPCData = error { + // Will happen if the extension is not enabled + Log.warning("\(#function): Unable to count logs: \(error). Is the XPC service running?") + } else { + Log.error(error) + } return "Unknown" } @@ -616,7 +622,12 @@ public struct SettingsView: View { window.contentViewController?.presentingViewController?.dismiss(self) } } catch { - Log.error(error) + if let error = error as? VPNConfigurationManagerError, + case VPNConfigurationManagerError.noIPCData = error { + Log.warning("\(#function): Error exporting logs: \(error). Is the XPC service running?") + } else { + Log.error(error) + } let alert = await NSAlert() await MainActor.run {