From 79384660613d088688137773b067b564ee5346d1 Mon Sep 17 00:00:00 2001 From: Henrik Panhans Date: Tue, 26 Mar 2024 14:30:19 +0100 Subject: [PATCH] Simplify error printing Signed-off-by: Henrik Panhans --- Sources/SwiftFrameCore/Extensions/NSError+Extensions.swift | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Sources/SwiftFrameCore/Extensions/NSError+Extensions.swift b/Sources/SwiftFrameCore/Extensions/NSError+Extensions.swift index 425a49d..6e71001 100644 --- a/Sources/SwiftFrameCore/Extensions/NSError+Extensions.swift +++ b/Sources/SwiftFrameCore/Extensions/NSError+Extensions.swift @@ -37,10 +37,7 @@ func ky_executeOrExit(verbose: Bool = false, _ work: () throws -> T) -> T { public func ky_exitWithError(_ error: Error, verbose: Bool = false) -> Never { let error = error as NSError - let errorMessage = verbose - ? CommandLineFormatter.formatError(error.description) - : CommandLineFormatter.formatError(error.localizedDescription) - print(errorMessage) + print(CommandLineFormatter.formatError(verbose ? error.description : error.localizedDescription)) error.expectation.flatMap { print(CommandLineFormatter.formatWarning(title: "EXPECTATION", text: $0)) } error.actualValue.flatMap { print(CommandLineFormatter.formatWarning(title: "ACTUAL", text: $0)) }