Files
Lyrebird/LiveCompile/Sources/LyrebirdLiveCompile/LiveCompileError.swift
T
josh b6fdee8bfc Lyrebird 2.0.0 — Linux support
Consolidated release: the cross-platform Linux port (engine, generators, CLI,
REPL, NRT, portable DSP), live ALSA audio + ALSA MIDI + POSIX OSC + portable
WAV codec, the GTK4 GUI (LyrebirdUI on the SwiftOpenUI backend), and the Linux
live-coding scratchpad (LiveCompile). Apple platforms unchanged; all additive.
See RELEASES.md and LINUX_README.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-09-10 21:09:11 -07:00

52 lines
1.8 KiB
Swift

// LiveCompileError.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
// LyrebirdLiveCompile — core
//
// Errors raised by `LiveCompiler.compile(source:)`. RT path never sees these:
// compilation is a main-thread (or background-queue) operation that runs long
// before any audio block.
import Foundation
#if os(macOS) || os(Linux)
public enum LiveCompileError: Error, CustomStringConvertible, Equatable, Sendable {
/// `xcrun -f swiftc` and the fallback paths all failed.
case swiftcNotFound
/// `swiftc` exited non-zero. `stderr` carries the raw compiler output; Phase
/// 144 parses it into structured diagnostics.
case compileFailed(exitCode: Int32, stderr: String)
/// `dlopen(dylibPath, RTLD_NOW)` returned `nil`. `message` is the `dlerror()`
/// string at the time of the failure.
case dlopenFailed(path: String, message: String)
/// The dylib opened but did not export the expected entry symbol.
case entrySymbolMissing(symbol: String, message: String)
/// A temp-dir / write step failed before `swiftc` was invoked.
case ioFailed(underlying: String)
public var description: String {
switch self {
case .swiftcNotFound:
return "swiftc binary not found in xcrun or standard toolchain paths"
case .compileFailed(let code, let stderr):
return "swiftc exited \(code):\n\(stderr)"
case .dlopenFailed(let path, let message):
return "dlopen failed for \(path): \(message)"
case .entrySymbolMissing(let symbol, let message):
return "missing snippet entry symbol \(symbol): \(message)"
case .ioFailed(let underlying):
return "IO step failed: \(underlying)"
}
}
}
#endif