Skip to content

Commit 902d833

Browse files
authored
Return Never for error log (#18)
This allows the `error` log to be used as a terminating instruction.
1 parent 224851f commit 902d833

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Sources/SourceParsingFramework/Utilities/Logger.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,11 @@ public func warning(_ message: String) {
9494
/// Log the given message at the `error` level and terminate.
9595
///
9696
/// - parameter message: The message to log.
97+
/// - returns: `Never`.
9798
/// - note: The mesasge is only logged if the current `minLoggingOutputLevel`
9899
/// is set at or below the `error` level.
99-
public func error(_ message: String) {
100+
/// - note: This method terminates the program. It returns `Never`.
101+
public func error(_ message: String) -> Never {
100102
log(message, atLevel: .error)
101103
exit(1)
102104
}

0 commit comments

Comments
 (0)