IOS-1540 Avoid Error.localizedDescription. IOS-1540_GOOD
authorDirk Zimmermann <dz@pep.security>
Tue, 11 Jun 2019 16:28:31 +0200
branchIOS-1540_GOOD
changeset 902552ece0de6d5d
parent 9024 b11f7271fd69
child 9026 30c7f02bdc5f
IOS-1540 Avoid Error.localizedDescription.
pEpForiOS/HTMLParser/Axt/HtmlToMarkdownSaxParser.swift
pEpForiOS/HTMLParser/Axt/HtmlToTextSaxParser.swift
pEpForiOS/UI/Handshake/HandshakeViewController.swift
pEpForiOS/UI/Handshake/ViewModel/HandshakePartnerTableViewCellViewModel.swift
pEpForiOS/UI/Login/LoginViewController.swift
pEpForiOS/UI/Login/ViewModel/LoginViewModel.swift
pEpForiOS/UI/ManualLogin/SMTPSetup/SMTPSettingsTableViewController.swift
pEpForiOS/UI/Settings/Setting/AccountSettings/AccountSettingsTableViewController.swift
pEpForiOS/UI/Settings/Setting/AccountSettings/ViewModel/AccountSettingsViewModel.swift
pEpForiOS/UI/Util/SecureWebViewController/SecureWebViewController.swift
pEpForiOS/Util/UserNotificationTool.swift
subModules/pEpIOSToolbox/pEpIOSToolbox/Foundation/Data+Extensions.swift
subModules/pEpIOSToolbox/pEpIOSToolbox/Foundation/String+Extensions.swift
     1.1 --- a/pEpForiOS/HTMLParser/Axt/HtmlToMarkdownSaxParser.swift	Tue Jun 11 16:28:31 2019 +0200
     1.2 +++ b/pEpForiOS/HTMLParser/Axt/HtmlToMarkdownSaxParser.swift	Tue Jun 11 16:28:31 2019 +0200
     1.3 @@ -62,6 +62,6 @@
     1.4      }
     1.5  
     1.6      func parser(_ parser: AXHTMLParser, parseErrorOccurred parseError: Error) {
     1.7 -        Log.shared.errorAndCrash("%@", parseError.localizedDescription)
     1.8 +        Log.shared.errorAndCrash(error: parseError)
     1.9      }
    1.10  }
     2.1 --- a/pEpForiOS/HTMLParser/Axt/HtmlToTextSaxParser.swift	Tue Jun 11 16:28:31 2019 +0200
     2.2 +++ b/pEpForiOS/HTMLParser/Axt/HtmlToTextSaxParser.swift	Tue Jun 11 16:28:31 2019 +0200
     2.3 @@ -60,6 +60,6 @@
     2.4      }
     2.5  
     2.6      func parser(_ parser: AXHTMLParser, parseErrorOccurred parseError: Error) {
     2.7 -        Log.shared.error("%@", parseError.localizedDescription)
     2.8 +        Log.shared.error("%@", parseError as CVarArg)
     2.9      }
    2.10  }
     3.1 --- a/pEpForiOS/UI/Handshake/HandshakeViewController.swift	Tue Jun 11 16:28:31 2019 +0200
     3.2 +++ b/pEpForiOS/UI/Handshake/HandshakeViewController.swift	Tue Jun 11 16:28:31 2019 +0200
     3.3 @@ -268,7 +268,7 @@
     3.4          do {
     3.5              languages = try theSession.languageList()
     3.6          } catch let err as NSError {
     3.7 -            Log.shared.error("%@", err.localizedDescription)
     3.8 +            Log.shared.error("%@", err as CVarArg)
     3.9              languages = []
    3.10          }
    3.11  
    3.12 @@ -321,7 +321,7 @@
    3.13          do {
    3.14              destination.languages = try theSession.languageList()
    3.15          } catch let err as NSError {
    3.16 -            Log.shared.error("%@", err.localizedDescription)
    3.17 +            Log.shared.error("%@", err as CVarArg)
    3.18              destination.languages = []
    3.19          }
    3.20      }
     4.1 --- a/pEpForiOS/UI/Handshake/ViewModel/HandshakePartnerTableViewCellViewModel.swift	Tue Jun 11 16:28:31 2019 +0200
     4.2 +++ b/pEpForiOS/UI/Handshake/ViewModel/HandshakePartnerTableViewCellViewModel.swift	Tue Jun 11 16:28:31 2019 +0200
     4.3 @@ -108,7 +108,7 @@
     4.4          do {
     4.5              isPartnerpEpUser = try session.isPEPUser(pEpPartner).boolValue
     4.6          } catch let err as NSError {
     4.7 -            Log.shared.error("%@", err.localizedDescription)
     4.8 +            Log.shared.error("%@", err as CVarArg)
     4.9              isPartnerpEpUser = false
    4.10          }
    4.11          setPartnerImage(for: partner)
    4.12 @@ -159,7 +159,7 @@
    4.13                  language: trustwordsLanguage,
    4.14                  full: trustwordsFull)
    4.15          } catch let err as NSError {
    4.16 -            Log.shared.error("%@", err.localizedDescription)
    4.17 +            Log.shared.error("%@", err as CVarArg)
    4.18              return nil
    4.19          }
    4.20      }
     5.1 --- a/pEpForiOS/UI/Login/LoginViewController.swift	Tue Jun 11 16:28:31 2019 +0200
     5.2 +++ b/pEpForiOS/UI/Login/LoginViewController.swift	Tue Jun 11 16:28:31 2019 +0200
     5.3 @@ -156,7 +156,7 @@
     5.4      }
     5.5  
     5.6      private func handleLoginError(error: Error, offerManualSetup: Bool) {
     5.7 -        Log.shared.error("%@", error.localizedDescription)
     5.8 +        Log.shared.error("%@", error as CVarArg)
     5.9          self.isCurrentlyVerifying = false
    5.10          guard let error = DisplayUserError(withError: error) else {
    5.11              // Do nothing. The error type is not suitable to bother the user with.
     6.1 --- a/pEpForiOS/UI/Login/ViewModel/LoginViewModel.swift	Tue Jun 11 16:28:31 2019 +0200
     6.2 +++ b/pEpForiOS/UI/Login/ViewModel/LoginViewModel.swift	Tue Jun 11 16:28:31 2019 +0200
     6.3 @@ -101,7 +101,7 @@
     6.4  
     6.5          func statusOk() {
     6.6              if let error = AccountSettings.AccountSettingsError(accountSettings: acSettings) {
     6.7 -                Log.shared.error("%@", error.localizedDescription)
     6.8 +                Log.shared.error("%@", error as CVarArg)
     6.9                  loginViewModelLoginErrorDelegate?.handle(loginError: error)
    6.10                  return
    6.11              }
    6.12 @@ -165,7 +165,7 @@
    6.13          do {
    6.14              try theVerificationService.verify()
    6.15          } catch {
    6.16 -            Log.shared.error("%@", error.localizedDescription)
    6.17 +            Log.shared.error("%@", error as CVarArg)
    6.18              loginViewModelLoginErrorDelegate?.handle(loginError: error)
    6.19          }
    6.20      }
    6.21 @@ -230,7 +230,7 @@
    6.22                  result: .smtpError(smtpError))
    6.23          } else {
    6.24              if let theError = error {
    6.25 -                Log.shared.errorAndCrash("%@", theError.localizedDescription)
    6.26 +                Log.shared.errorAndCrash(error: theError)
    6.27              } else {
    6.28                  accountVerificationResultDelegate?.didVerify(result: .ok)
    6.29              }
    6.30 @@ -245,7 +245,7 @@
    6.31                  informAccountVerificationResultDelegate(error: nil)
    6.32                  mySelfer?.startMySelf()
    6.33              } catch {
    6.34 -                Log.shared.errorAndCrash("%@", error.localizedDescription)
    6.35 +                Log.shared.errorAndCrash(error: error)
    6.36              }
    6.37          case .failure(let error):
    6.38              informAccountVerificationResultDelegate(error: error)
     7.1 --- a/pEpForiOS/UI/ManualLogin/SMTPSetup/SMTPSettingsTableViewController.swift	Tue Jun 11 16:28:31 2019 +0200
     7.2 +++ b/pEpForiOS/UI/ManualLogin/SMTPSetup/SMTPSettingsTableViewController.swift	Tue Jun 11 16:28:31 2019 +0200
     7.3 @@ -230,7 +230,7 @@
     7.4                  do {
     7.5                      try theSelf.model?.save()
     7.6                  } catch {
     7.7 -                    Log.shared.errorAndCrash("%@", error.localizedDescription)
     7.8 +                    Log.shared.errorAndCrash(error: error)
     7.9                  }
    7.10              }
    7.11              GCD.onMain() {  [weak self] in
     8.1 --- a/pEpForiOS/UI/Settings/Setting/AccountSettings/AccountSettingsTableViewController.swift	Tue Jun 11 16:28:31 2019 +0200
     8.2 +++ b/pEpForiOS/UI/Settings/Setting/AccountSettings/AccountSettingsTableViewController.swift	Tue Jun 11 16:28:31 2019 +0200
     8.3 @@ -303,7 +303,7 @@
     8.4  
     8.5  extension AccountSettingsTableViewController {
     8.6      public func handleLoginError(error: Error) {
     8.7 -        Log.shared.error("%@", error.localizedDescription)
     8.8 +        Log.shared.error("%@", error as CVarArg)
     8.9          UIUtils.show(error: error, inViewController: self)
    8.10      }
    8.11  }
     9.1 --- a/pEpForiOS/UI/Settings/Setting/AccountSettings/ViewModel/AccountSettingsViewModel.swift	Tue Jun 11 16:28:31 2019 +0200
     9.2 +++ b/pEpForiOS/UI/Settings/Setting/AccountSettings/ViewModel/AccountSettingsViewModel.swift	Tue Jun 11 16:28:31 2019 +0200
     9.3 @@ -217,7 +217,7 @@
     9.4                  try verifiableAccount?.save()
     9.5                  delegate?.didVerify(result: .ok)
     9.6              } catch {
     9.7 -                Log.shared.errorAndCrash("%@", error.localizedDescription)
     9.8 +                Log.shared.errorAndCrash(error: error)
     9.9              }
    9.10          case .failure(let error):
    9.11              if let imapError = error as? ImapSyncError {
    9.12 @@ -227,7 +227,7 @@
    9.13                  delegate?.didVerify(
    9.14                      result: .smtpError(smtpError))
    9.15              } else {
    9.16 -                Log.shared.errorAndCrash("%@", error.localizedDescription)
    9.17 +                Log.shared.errorAndCrash(error: error)
    9.18              }
    9.19          }
    9.20      }
    10.1 --- a/pEpForiOS/UI/Util/SecureWebViewController/SecureWebViewController.swift	Tue Jun 11 16:28:31 2019 +0200
    10.2 +++ b/pEpForiOS/UI/Util/SecureWebViewController/SecureWebViewController.swift	Tue Jun 11 16:28:31 2019 +0200
    10.3 @@ -169,7 +169,7 @@
    10.4                  encodedContentRuleList: blockRules) { (contentRuleList, error) in
    10.5                      if let error = error {
    10.6                          Log.shared.errorAndCrash(
    10.7 -                            "Compile error: %@", error.localizedDescription)
    10.8 +                            "Compile error: %@", error as CVarArg)
    10.9                          return
   10.10                      }
   10.11                      compiledBlockList = contentRuleList
    11.1 --- a/pEpForiOS/Util/UserNotificationTool.swift	Tue Jun 11 16:28:31 2019 +0200
    11.2 +++ b/pEpForiOS/Util/UserNotificationTool.swift	Tue Jun 11 16:28:31 2019 +0200
    11.3 @@ -66,7 +66,7 @@
    11.4                  if let error = error {
    11.5                      Log.shared.warn(
    11.6                          "Error posting user notification: %@",
    11.7 -                        error.localizedDescription)
    11.8 +                        error as CVarArg)
    11.9                  }
   11.10              }
   11.11          } else {
    12.1 --- a/subModules/pEpIOSToolbox/pEpIOSToolbox/Foundation/Data+Extensions.swift	Tue Jun 11 16:28:31 2019 +0200
    12.2 +++ b/subModules/pEpIOSToolbox/pEpIOSToolbox/Foundation/Data+Extensions.swift	Tue Jun 11 16:28:31 2019 +0200
    12.3 @@ -40,7 +40,7 @@
    12.4                  withJSONObject: self, options: .prettyPrinted)
    12.5              jsonData.debugSave(basePath: basePath, fileName: fileName, ext: ext)
    12.6          } catch let err {
    12.7 -            Log.shared.error("%@", err.localizedDescription)
    12.8 +            Log.shared.error("%@", err as CVarArg)
    12.9          }
   12.10      }
   12.11  }
    13.1 --- a/subModules/pEpIOSToolbox/pEpIOSToolbox/Foundation/String+Extensions.swift	Tue Jun 11 16:28:31 2019 +0200
    13.2 +++ b/subModules/pEpIOSToolbox/pEpIOSToolbox/Foundation/String+Extensions.swift	Tue Jun 11 16:28:31 2019 +0200
    13.3 @@ -178,7 +178,7 @@
    13.4              let matches = regex.matches(in: self, options: [], range: wholeRange())
    13.5              return matches.count > 0
    13.6          } catch {
    13.7 -            Log.shared.errorAndCrash("%@", error.localizedDescription)
    13.8 +            Log.shared.errorAndCrash(error: error)
    13.9          }
   13.10          return false
   13.11      }
   13.12 @@ -209,8 +209,7 @@
   13.13                  }
   13.14              }
   13.15          } catch {
   13.16 -            Log.shared.errorAndCrash("%@",
   13.17 -                                                        error.localizedDescription)
   13.18 +            Log.shared.errorAndCrash(error: error)
   13.19          }
   13.20          return self
   13.21      }
   13.22 @@ -233,8 +232,7 @@
   13.23                  }
   13.24              }
   13.25          } catch {
   13.26 -            Log.shared.errorAndCrash("%@",
   13.27 -                                                        error.localizedDescription)
   13.28 +            Log.shared.errorAndCrash(error: error)
   13.29          }
   13.30          return self
   13.31      }