Skip to content

Commit f031821

Browse files
committed
improve error print
1 parent 986c4db commit f031821

File tree

2 files changed

+4
-15
lines changed

2 files changed

+4
-15
lines changed

Sources/SystemExtensionKit/SystemExtensionKit+.swift

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Foundation
99
import SystemExtensions
1010

1111
public extension SystemExtensionKit {
12-
enum ExtensionError: Error {
12+
enum ExtensionError: LocalizedError {
1313
case extensionDirectoryFailed(String, Error)
1414
case extensionNotExist
1515
case extensionCreateURLFailed(String)
@@ -18,7 +18,7 @@ public extension SystemExtensionKit {
1818
case extensionNeedReboot
1919
case extensionSystemUnsupport
2020

21-
var localizedDescription: String {
21+
public var errorDescription: String? {
2222
switch self {
2323
case .extensionDirectoryFailed(let urlStr, let error):
2424
return "Failed to get the contents of \(urlStr): \(error.localizedDescription)"
@@ -158,14 +158,3 @@ extension OSSystemExtensionError.Code: CustomStringConvertible {
158158
}
159159
}
160160
}
161-
162-
// MARK: - Error Convinience
163-
164-
public extension Error {
165-
var systemExtensionDescription: String {
166-
guard let error = self as? SystemExtensionKit.ExtensionError else {
167-
return localizedDescription
168-
}
169-
return error.localizedDescription
170-
}
171-
}

Sources/SystemExtensionKit/SystemExtensionKit.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import SystemExtensions
1212
#error("SystemExtensionKit doesn't support Swift versions below 5.5.")
1313
#endif
1414

15-
/// Current SystemExtensionKit version 2.0.6. Necessary since SPM doesn't use dynamic libraries. Plus this will be more accurate.
16-
public let version = "2.0.6"
15+
/// Current SystemExtensionKit version 2.0.7. Necessary since SPM doesn't use dynamic libraries. Plus this will be more accurate.
16+
public let version = "2.0.7"
1717

1818
public let SystemExtension = SystemExtensionKit.shared
1919

0 commit comments

Comments
 (0)