Files
playdate-kit/Sources/PlaydateKit/Network/Enumerations/NetError.swift
T

50 lines
1.5 KiB
Swift
Raw Normal View History

internal import CPlaydate
extension Network {
2026-09-18 13:15:08 +00:00
/// A network error. Wraps the negative `PDNetErr` codes.
public enum NetError: Int32, Swift.Error, Sendable {
2026-09-18 13:15:08 +00:00
/// `NET_NO_DEVICE`.
case noDevice = -1
2026-09-18 13:15:08 +00:00
/// `NET_BUSY`.
case busy = -2
2026-09-18 13:15:08 +00:00
/// `NET_WRITE_ERROR`.
case writeError = -3
2026-09-18 13:15:08 +00:00
/// `NET_WRITE_BUSY`.
case writeBusy = -4
2026-09-18 13:15:08 +00:00
/// `NET_WRITE_TIMEOUT`.
case writeTimeout = -5
2026-09-18 13:15:08 +00:00
/// `NET_READ_ERROR`.
case readError = -6
2026-09-18 13:15:08 +00:00
/// `NET_READ_BUSY`.
case readBusy = -7
2026-09-18 13:15:08 +00:00
/// `NET_READ_TIMEOUT`.
case readTimeout = -8
2026-09-18 13:15:08 +00:00
/// `NET_READ_OVERFLOW`.
case readOverflow = -9
2026-09-18 13:15:08 +00:00
/// `NET_FRAME_ERROR`.
case frameError = -10
2026-09-18 13:15:08 +00:00
/// `NET_BAD_RESPONSE`.
case badResponse = -11
2026-09-18 13:15:08 +00:00
/// `NET_ERROR_RESPONSE`.
case errorResponse = -12
2026-09-18 13:15:08 +00:00
/// `NET_RESET_TIMEOUT`.
case resetTimeout = -13
2026-09-18 13:15:08 +00:00
/// `NET_BUFFER_TOO_SMALL`.
case bufferTooSmall = -14
2026-09-18 13:15:08 +00:00
/// `NET_UNEXPECTED_RESPONSE`.
case unexpectedResponse = -15
2026-09-18 13:15:08 +00:00
/// `NET_NOT_CONNECTED_TO_AP`.
case notConnectedToAP = -16
2026-09-18 13:15:08 +00:00
/// `NET_NOT_IMPLEMENTED`.
case notImplemented = -17
2026-09-18 13:15:08 +00:00
/// `NET_CONNECTION_CLOSED`.
case connectionClosed = -18
2026-09-18 13:15:08 +00:00
/// A code not in `PDNetErr`.
case unknown = 1
init(_ error: PDNetErr) {
self = NetError(rawValue: Int32(error.rawValue)) ?? .unknown
}
}
}