From 71a0b4577fd487a06a778b97c487858b0a3b0edd Mon Sep 17 00:00:00 2001 From: Anthony Date: Thu, 12 Feb 2026 00:42:08 +0100 Subject: [PATCH] Add `LocalizedError` conformance to `ContainerizationError` (#528) Without `LocalizedError` conformance, calling `localizedDescription` on a `ContainerizationError` falls back to the default representation (e.g., "ContainerizationError.ContainerizationError error 1.") instead of returning the actual error message. This makes it difficult to show meaningful errors in a UI, where `localizedDescription` is the standard way to get a user-facing string. --- Sources/ContainerizationError/ContainerizationError.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Sources/ContainerizationError/ContainerizationError.swift b/Sources/ContainerizationError/ContainerizationError.swift index 748a1302..ed14b223 100644 --- a/Sources/ContainerizationError/ContainerizationError.swift +++ b/Sources/ContainerizationError/ContainerizationError.swift @@ -14,11 +14,13 @@ // limitations under the License. //===----------------------------------------------------------------------===// +import Foundation + /// The core error type for Containerization. /// /// Most API surfaces for the core container/process/agent types will /// return a ContainerizationError. -public struct ContainerizationError: Swift.Error, Sendable { +public struct ContainerizationError: Swift.Error, LocalizedError, Sendable { /// A code describing the error encountered. public var code: Code /// A description of the error. @@ -65,6 +67,10 @@ public struct ContainerizationError: Swift.Error, Sendable { public func isCode(_ code: Code) -> Bool { self.code == code } + + public var errorDescription: String? { + message + } } extension ContainerizationError: CustomStringConvertible {