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.
This commit is contained in:
Anthony authored and GitHub committed 2026-02-11 15:42:08 -08:00
1 parent 98391937da
commit 71a0b4577f
1 file changed
+7 -1
@@ -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 {