mirror of
https://github.com/metabolist/metatext.git
synced 2024-12-23 14:00:29 +00:00
16 lines
416 B
Swift
16 lines
416 B
Swift
|
// Copyright © 2020 Metabolist. All rights reserved.
|
||
|
|
||
|
import Foundation
|
||
|
|
||
|
extension NSError {
|
||
|
convenience init(status: OSStatus) {
|
||
|
var userInfo: [String: Any]?
|
||
|
|
||
|
if let errorMessage = SecCopyErrorMessageString(status, nil) {
|
||
|
userInfo = [NSLocalizedDescriptionKey: errorMessage]
|
||
|
}
|
||
|
|
||
|
self.init(domain: NSOSStatusErrorDomain, code: Int(status), userInfo: userInfo)
|
||
|
}
|
||
|
}
|