Skip to content

Commit d84ef9b

Browse files
committed
Errors
1 parent ac90eb4 commit d84ef9b

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

Sources/LiveKit/Agent/Agent.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17+
import Combine
1718
import Foundation
1819

1920
@MainActor

Sources/LiveKit/Agent/LocalMedia.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,22 @@
1515
*/
1616

1717
@preconcurrency import AVFoundation
18+
import Combine
19+
import Foundation
1820

1921
@MainActor
2022
open class LocalMedia: ObservableObject {
2123
// MARK: - Error
2224

2325
public enum Error: LocalizedError {
2426
case mediaDevice(Swift.Error)
27+
28+
public var errorDescription: String? {
29+
switch self {
30+
case let .mediaDevice(error):
31+
"Media device error: \(error.localizedDescription)"
32+
}
33+
}
2534
}
2635

2736
// MARK: - Devices

Sources/LiveKit/Agent/Session.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17+
import Combine
1718
import Foundation
1819
import OrderedCollections
1920

@@ -27,7 +28,14 @@ open class Session: ObservableObject {
2728
case failedToSend(Swift.Error)
2829

2930
public var errorDescription: String? {
30-
"TODO"
31+
switch self {
32+
case .agentNotConnected:
33+
"Agent not connected"
34+
case let .failedToConnect(error):
35+
"Failed to connect: \(error.localizedDescription)"
36+
case let .failedToSend(error):
37+
"Failed to send: \(error.localizedDescription)"
38+
}
3139
}
3240
}
3341

0 commit comments

Comments
 (0)