Skip to content

Commit f358ab9

Browse files
Refactors
1 parent 4bd724e commit f358ab9

File tree

2 files changed

+16
-24
lines changed

2 files changed

+16
-24
lines changed

CodeEdit/Features/LSP/Registry/RegistryManager+HandleRegistryFile.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ extension RegistryManager {
5959

6060
NotificationCenter.default.post(name: .RegistryUpdatedNotification, object: nil)
6161
} catch {
62-
print("Error details: \(error)")
62+
logger.error("Error updating: \(error)")
6363
handleUpdateError(RegistryManagerError.writeFailed(error: error))
6464
}
6565
}
@@ -68,16 +68,16 @@ extension RegistryManager {
6868
if let regError = error as? RegistryManagerError {
6969
switch regError {
7070
case .invalidResponse(let statusCode):
71-
print("Invalid response received: \(statusCode)")
71+
logger.error("Invalid response received: \(statusCode)")
7272
case let .downloadFailed(url, error):
73-
print("Download failed for \(url.absoluteString): \(error.localizedDescription)")
73+
logger.error("Download failed for \(url.absoluteString): \(error.localizedDescription)")
7474
case let .maxRetriesExceeded(url, error):
75-
print("Max retries exceeded for \(url.absoluteString): \(error.localizedDescription)")
75+
logger.error("Max retries exceeded for \(url.absoluteString): \(error.localizedDescription)")
7676
case let .writeFailed(error):
77-
print("Failed to write files to disk: \(error.localizedDescription)")
77+
logger.error("Failed to write files to disk: \(error.localizedDescription)")
7878
}
7979
} else {
80-
print("Unexpected registry error: \(error.localizedDescription)")
80+
logger.error("Unexpected registry error: \(error.localizedDescription)")
8181
}
8282
}
8383

CodeEdit/Features/LSP/Registry/RegistryManager.swift

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@
55
// Created by Abe Malla on 1/29/25.
66
//
77

8+
import OSLog
89
import Foundation
910
import ZIPFoundation
1011

1112
@MainActor
1213
final class RegistryManager {
1314
static let shared: RegistryManager = .init()
1415

16+
let logger = Logger(subsystem: Bundle.main.bundleIdentifier ?? "", category: "RegistryManager")
17+
1518
let installPath = Settings.shared.baseURL.appending(path: "Language Servers")
1619

1720
/// The URL of where the registry.json file will be downloaded from
@@ -143,24 +146,13 @@ final class RegistryManager {
143146
fail failed: Bool
144147
) {
145148
if failed {
146-
NotificationCenter.default.post(
147-
name: .taskNotification,
148-
object: nil,
149-
userInfo: [
150-
"id": id,
151-
"action": "update",
152-
"title": "Could not install \(activityName)",
153-
"isLoading": false
154-
]
155-
)
156-
NotificationCenter.default.post(
157-
name: .taskNotification,
158-
object: nil,
159-
userInfo: [
160-
"id": id,
161-
"action": "deleteWithDelay",
162-
"delay": 5.0,
163-
]
149+
NotificationManager.shared.post(
150+
iconSymbol: "xmark.circle",
151+
iconColor: .clear,
152+
title: "Could not install \(activityName)",
153+
description: "There was a problem during installation.",
154+
actionButtonTitle: "Done",
155+
action: {},
164156
)
165157
} else {
166158
NotificationCenter.default.post(

0 commit comments

Comments
 (0)