feat(core): add scheme error type

This commit is contained in:
dualfroz committed 2026-08-23 16:20:00 +02:00
1 parent 48092fe48f
commit 549631fe99
1 file changed
+19
+19
View File
@@ -0,0 +1,19 @@
public struct SchemeError: Error, CustomStringConvertible {
public let message: String
public let irritants: [Value]
public init(_ message: String, irritants: [Value] = []) {
self.message = message
self.irritants = irritants
}
public var description: String {
if irritants.isEmpty { return message }
let parts = irritants.map { writeString($0) }.joined(separator: " ")
return "\(message) \(parts)"
}
}
func schemeError(_ message: String, _ irritants: [Value] = []) -> SchemeError {
SchemeError(message, irritants: irritants)
}