mirror of
https://github.com/passepartoutvpn/wireguard-apple.git
synced 2025-02-16 12:52:06 +00:00
Importing: Show OS error when unable to open a .conf file
Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
parent
d3df8734c2
commit
ab6d714070
@ -28,8 +28,14 @@ class TunnelImporter {
|
||||
let fileContents: String
|
||||
do {
|
||||
fileContents = try String(contentsOf: url)
|
||||
} catch {
|
||||
errorPresenterType.showErrorAlert(title: tr("alertCantOpenInputConfFileTitle"), message: tr(format: "alertCantOpenInputConfFileMessage (%@)", fileName), from: sourceVC, onPresented: completionHandler)
|
||||
} catch let error {
|
||||
let message: String
|
||||
if let cocoaError = error as? CocoaError, cocoaError.isFileError {
|
||||
message = error.localizedDescription
|
||||
} else {
|
||||
message = tr(format: "alertCantOpenInputConfFileMessage (%@)", fileName)
|
||||
}
|
||||
errorPresenterType.showErrorAlert(title: tr("alertCantOpenInputConfFileTitle"), message: message, from: sourceVC, onPresented: completionHandler)
|
||||
return
|
||||
}
|
||||
if let tunnelConfiguration = try? TunnelConfiguration(fromWgQuickConfig: fileContents, called: fileBaseName) {
|
||||
|
Loading…
Reference in New Issue
Block a user