try? changed to try with error handling

This commit is contained in:
Stuart Breckenridge
2021-09-21 09:22:45 +08:00
parent 78e0595708
commit c29afd2677
7 changed files with 106 additions and 86 deletions

View File

@@ -112,7 +112,11 @@ extension ArticleThemesTableViewController: UIDocumentPickerDelegate {
func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) {
guard let url = urls.first else { return }
try? ArticleThemeImporter.importTheme(controller: self, filename: url.standardizedFileURL.path)
do {
try ArticleThemeImporter.importTheme(controller: self, filename: url.standardizedFileURL.path)
} catch {
NotificationCenter.default.post(name: .didFailToImportThemeWithError, object: nil, userInfo: ["error": error])
}
}
}