Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ let package = Package(
],
dependencies: [
.package(url: "https://github.com/apple/swift-docc-plugin", exact: "1.0.0"),
.package(url: "https://github.com/GetStream/stream-core-swift.git", branch: "chat-concurrency-and-timers")
.package(url: "https://github.com/GetStream/stream-core-swift.git", branch: "chat-errors")
],
targets: [
.target(
Expand Down
1 change: 0 additions & 1 deletion Sources/StreamChat/APIClient/RequestEncoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,6 @@ protocol ConnectionDetailsProviderDelegate: AnyObject {
}

public extension ClientError {
final class InvalidURL: ClientError, @unchecked Sendable {}
final class InvalidJSON: ClientError, @unchecked Sendable {}
final class MissingConnectionId: ClientError, @unchecked Sendable {}
}
4 changes: 0 additions & 4 deletions Sources/StreamChat/Config/Token.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@ public extension Token {
}
}

extension ClientError {
public final class InvalidToken: ClientError, @unchecked Sendable {}
}

private extension String {
var jwtPayload: [String: Any]? {
let parts = split(separator: ".")
Expand Down
84 changes: 0 additions & 84 deletions Sources/StreamChat/Errors/ClientError.swift

This file was deleted.

77 changes: 0 additions & 77 deletions Sources/StreamChat/Errors/ErrorPayload.swift

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,6 @@ extension Error {
return false
}

var isRateLimitError: Bool {
if let error = (self as? ClientError)?.underlyingError as? ErrorPayload,
error.statusCode == 429 {
return true
}
return false
}

var isSocketNotConnectedError: Bool {
has(parameters: (NSPOSIXErrorDomain, 57))
}
Expand Down
18 changes: 0 additions & 18 deletions Sources/StreamChat/WebSocketClient/Events/EventDecoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,6 @@ extension ClientError {
public final class IgnoredEventType: ClientError, @unchecked Sendable {
override public var localizedDescription: String { "The incoming event type is not supported. Ignoring." }
}

public final class EventDecoding: ClientError, @unchecked Sendable {
override init(_ message: String, _ file: StaticString = #file, _ line: UInt = #line) {
super.init(message, file, line)
}

init<T>(missingValue: String, for type: T.Type, _ file: StaticString = #file, _ line: UInt = #line) {
super.init("`\(missingValue)` field can't be `nil` for the `\(type)` event.", file, line)
}

init(missingValue: String, for type: EventType, _ file: StaticString = #file, _ line: UInt = #line) {
super.init("`\(missingValue)` field can't be `nil` for the `\(type.rawValue)` event.", file, line)
}

init(failedParsingValue: String, for type: EventType, with error: Error, _ file: StaticString = #file, _ line: UInt = #line) {
super.init("`\(failedParsingValue)` failed to parse for the `\(type.rawValue)` event. Error: \(error)", file, line)
}
}
}

/// A type-erased wrapper protocol for `EventDecoder`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ extension EventPayload {
/// Get an unwrapped value from the payload or throw an error.
func value<Value>(at keyPath: KeyPath<EventPayload, Value?>) throws -> Value {
guard let value = self[keyPath: keyPath] else {
throw ClientError.EventDecoding(missingValue: keyPath.stringValue, for: eventType)
throw ClientError.EventDecoding(missingValue: keyPath.stringValue, for: eventType.rawValue)
}

return value
Expand All @@ -252,11 +252,11 @@ extension EventPayload {
/// Get the value from the event payload and if it is a `Result` report the decoding error.
func value<Value>(at keyPath: KeyPath<EventPayload, Result<Value, Error>?>) throws -> Value {
guard let value = self[keyPath: keyPath] else {
throw ClientError.EventDecoding(missingValue: keyPath.stringValue, for: eventType)
throw ClientError.EventDecoding(missingValue: keyPath.stringValue, for: eventType.rawValue)
}

if let error = value.error {
throw ClientError.EventDecoding(failedParsingValue: keyPath.stringValue, for: eventType, with: error)
throw ClientError.EventDecoding(failedParsingValue: keyPath.stringValue, for: eventType.rawValue, with: error)
}

return try value.get()
Expand Down
4 changes: 0 additions & 4 deletions Sources/StreamChat/WebSocketClient/WebSocketClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,6 @@ extension WebSocketClient {
}
#endif

extension ClientError {
public final class WebSocket: ClientError, @unchecked Sendable {}
}

/// WebSocket Error
struct WebSocketErrorContainer: Decodable {
/// A server error was received.
Expand Down
Loading
Loading