Fixes logging non-ALTServerErrors errors as ALTServerError.underlyingError

This commit is contained in:
Riley Testut
2022-11-01 17:26:02 -05:00
parent 1ce7681a31
commit 7d48f5a7f3

View File

@@ -67,7 +67,16 @@ public class LoggedError: NSManagedObject, Fetchable
self.date = date
self._operation = operation?.rawValue
let nsError = error as NSError
let nsError: NSError
if let error = error as? ALTServerError, error.code == .underlyingError, let underlyingError = error.underlyingError
{
nsError = underlyingError as NSError
}
else
{
nsError = error as NSError
}
self.domain = nsError.domain
self.code = Int32(nsError.code)
self.userInfo = nsError.userInfo