MongoCore/Error.swift

MongoKitten · Sources/MongoCore/Error.swift · swift · MIT
database

Defines Swift errors for MongoDB protocol parsing, serialization, and URI validation.

// Source: https://github.com/orlandos-nl/MongoKitten | License: MIT | Copyright 2016-2023 Joannis Orlandos & Robbert Brandsma
// Provided via justclaw.it.com; keep this notice with the code.
/// An error that occurs when a connection fails due to a protocol error.
public struct MongoProtocolParsingError: Error, Codable, CustomStringConvertible {
    public enum Reason: String, Codable, CustomStringConvertible, Equatable, Sendable {
        case unsupportedOpCode
        case unexpectedValue
        case missingDocumentBody

        public var description: String {
            switch self {
            case .unexpectedValue:
                return "The value found in the result cursor did not match the expectation"
            case .unsupportedOpCode:
                return "The server rep

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key