Adds ALTLocalizedError.underlyingError

Allows for easily wrapping underlying errors while preserving localized descriptions.
This commit is contained in:
Riley Testut
2021-02-26 13:50:50 -06:00
parent 77c085ef1a
commit 6e4feecff0
2 changed files with 37 additions and 5 deletions

View File

@@ -49,7 +49,7 @@ class ToastView: RSTToastView
convenience init(error: Error)
{
var error = error as NSError
var underlyingError = error.userInfo[NSUnderlyingErrorKey] as? NSError
var underlyingError = error.underlyingError
var preferredDuration: TimeInterval?
@@ -59,7 +59,7 @@ class ToastView: RSTToastView
{
// Treat underlyingError as the primary error.
error = unwrappedUnderlyingError
error = unwrappedUnderlyingError as NSError
underlyingError = nil
preferredDuration = .longToastViewDuration