Skip to content

Commit 16c922f

Browse files
committed
Improved error handling
1 parent b17e79a commit 16c922f

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Source/TriangleDrawMain/Browser/BrowserViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ extension BrowserViewController: UIDocumentBrowserViewControllerDelegate {
249249
log.error("documentURL: '\(documentURL)' error: nil")
250250
}
251251

252-
// Show an error to the user
252+
// Show the error to the user
253253
let errorMessage: String = error.map { "\($0)" } ?? "The error is 'nil'. No info provided."
254254
let alert = UIAlertController(title: "Error in failedToImportDocumentAt", message: errorMessage, preferredStyle: .alert)
255255
let action = UIAlertAction(title: "OK", style: .default) { (_) in }

Source/TriangleDrawMain/Main/AppDelegate.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
122122
return
123123
}
124124

125+
guard let url = revealedDocumentURL else {
126+
log.error("revealDocument. No URL revealed. inputURL \(inputURL)")
127+
return
128+
}
129+
125130
// Present the Document View Controller for the revealed URL.
126131
browserViewController.presentDocument(
127-
at: revealedDocumentURL!,
132+
at: url,
128133
animated: true,
129134
displayNameBehavior: .extractFromURL
130135
)

0 commit comments

Comments
 (0)