// SourceKitLSPError.swift // Lyrebird // // Copyright (c) 2026 Joshua Parmenter / realizedsound // SPDX-License-Identifier: MIT // LyrebirdLiveCompile // // Errors surfaced by ``SourceKitLSPClient``. macOS only. #if os(macOS) /// A failure from the `sourcekit-lsp` client. public enum SourceKitLSPError: Error, CustomStringConvertible { /// The `sourcekit-lsp` executable could not be launched (bad path, missing /// toolchain, spawn failure). Thrown from ``SourceKitLSPClient/start(rootURI:)``. case launchFailed(String) /// A request was made against a client that was never started or has been /// shut down (or the server exited). Also used to fail in-flight requests /// when the server dies. case notRunning /// A request exceeded the client's per-request timeout. Guards against a /// wedged server; carries the LSP method that timed out. case timedOut(method: String) /// The server returned a JSON-RPC error response, carrying its code and /// message. case serverError(code: Int, message: String) public var description: String { switch self { case .launchFailed(let m): return "sourcekit-lsp failed to launch: \(m)" case .notRunning: return "sourcekit-lsp is not running" case .timedOut(let m): return "sourcekit-lsp timed out on \(m)" case .serverError(let c, let m): return "sourcekit-lsp error \(c): \(m)" } } } #endif