Skip to content

Commit

Permalink
Simplify error printing
Browse files Browse the repository at this point in the history
Signed-off-by: Henrik Panhans <[email protected]>
  • Loading branch information
henrik-dmg committed Mar 26, 2024
1 parent b6c1749 commit 7938466
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions Sources/SwiftFrameCore/Extensions/NSError+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ func ky_executeOrExit<T>(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)) }
Expand Down

0 comments on commit 7938466

Please sign in to comment.