Skip to content

Commit d26cdf0

Browse files
committed
passthrough error
1 parent 99625c9 commit d26cdf0

File tree

2 files changed

+10
-24
lines changed

2 files changed

+10
-24
lines changed

Sources/Data/ConsolePipe.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,15 @@ package actor ConsolePipe {
5252
}
5353
}
5454

55-
enum Error: Swift.Error {
55+
enum Error: LocalizedError {
5656
case failedToCaptureConsoleOutput
57+
58+
var errorDescription: String? {
59+
switch self {
60+
case .failedToCaptureConsoleOutput:
61+
"Failed to capture console output."
62+
}
63+
}
5764
}
5865

5966
package typealias Handler = @Sendable (ConsoleOutput) -> Void

Sources/VisualLogger/VisualLogger.swift

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -142,28 +142,7 @@ public actor VisualLogger: LogEntrySourceProtocol {
142142
try await consolePipe { output in
143143
Task { [unowned self] in
144144
await dataStore.addLogEntry(
145-
{
146-
switch output {
147-
case let .logEntry(logEntry):
148-
logEntry
149-
case let .text(subtitle):
150-
LogEntry(
151-
category: .debug,
152-
source: "Console",
153-
content: LogEntryContent(
154-
title: "",
155-
subtitle: subtitle
156-
)
157-
)
158-
case let .userInfo(userInfo):
159-
LogEntry(
160-
category: .debug,
161-
source: "Console",
162-
content: "",
163-
userInfo: userInfo
164-
)
165-
}
166-
}()
145+
output.logEntry()
167146
)
168147
}
169148
}
@@ -173,7 +152,7 @@ public actor VisualLogger: LogEntrySourceProtocol {
173152
LogEntry(
174153
category: .error,
175154
source: "Visual Logger",
176-
content: "Couldn't start observing console output."
155+
content: LogEntryContent(title: error.localizedDescription)
177156
)
178157
)
179158
}

0 commit comments

Comments
 (0)