diff --git a/Sources/ErrorKit/Catching.swift b/Sources/ErrorKit/Catching.swift index 9290d11..443a8b5 100644 --- a/Sources/ErrorKit/Catching.swift +++ b/Sources/ErrorKit/Catching.swift @@ -178,7 +178,7 @@ extension Catching { /// - Returns: The value returned by the operation if successful. /// - Throws: An instance of `Self` with the original error wrapped in the `caught` case. public static func `catch`( - _ operation: () async throws -> ReturnType + _ operation: @Sendable () async throws -> ReturnType ) async throws(Self) -> ReturnType { do { return try await operation() diff --git a/Sources/ErrorKit/ErrorKit.swift b/Sources/ErrorKit/ErrorKit.swift index 277cfcb..1c14ba8 100644 --- a/Sources/ErrorKit/ErrorKit.swift +++ b/Sources/ErrorKit/ErrorKit.swift @@ -148,10 +148,12 @@ public enum ErrorKit { /// 2. Shows the underlying cause (DatabaseError.connectionFailed) /// 3. Provides the user-friendly message for context (users will report this) /// - /// - Parameter error: The error to describe, potentially containing nested errors + /// - Parameters: + /// - error: The error to describe, potentially containing nested errors + /// - indent: The initial indent string (normally "") /// - Returns: A formatted string showing the complete error hierarchy with indentation - public static func errorChainDescription(for error: Error) -> String { - return Self.chainDescription(for: error, indent: "", enclosingType: type(of: error)) + public static func errorChainDescription(for error: Error, indent: String = "") -> String { + return Self.chainDescription(for: error, indent: indent, enclosingType: type(of: error)) } private static func chainDescription(for error: Error, indent: String, enclosingType: Any.Type?) -> String {