-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Conform Swiftly's Error type to CustomStringConvertible (#203)
`swift-argument-parser` will use an Error's description when printing the error. This patch conforms Swiftly's Error type to CustomStringConvertible, which will show the actual message in stdout instead of the object's description of `Error(message: "...")` Issue: #201
- Loading branch information
1 parent
8aa8d18
commit c7fe40d
Showing
2 changed files
with
6 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
import Foundation | ||
|
||
public struct Error: LocalizedError { | ||
public struct Error: LocalizedError, CustomStringConvertible { | ||
public let message: String | ||
|
||
public init(message: String) { | ||
self.message = message | ||
} | ||
|
||
public var errorDescription: String? { self.message } | ||
public var errorDescription: String { self.message } | ||
public var description: String { self.message } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters