1
0
mirror of https://github.com/metabolist/metatext synced 2024-12-26 09:42:48 +01:00
metatext-app-ios-iphone-ipad/Shared/Extensions/NSError+Extensions.swift
2020-07-31 00:13:54 -07:00

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)
}
}