Append exception desc to parsing error alert

This commit is contained in:
Davide De Rosa 2018-10-18 09:32:18 +02:00
parent 684480c826
commit ccd5e2d03e
3 changed files with 7 additions and 5 deletions

View File

@ -120,8 +120,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
let alert = Macros.alert(L10n.Organizer.Sections.Hosts.header, L10n.Wizards.Host.Alerts.unsupported(option))
alert.addCancelAction(L10n.Global.ok)
root.present(alert, animated: true, completion: nil)
} catch {
let alert = Macros.alert(L10n.Organizer.Sections.Hosts.header, L10n.Wizards.Host.Alerts.parsing)
} catch let e {
let alert = Macros.alert(L10n.Organizer.Sections.Hosts.header, L10n.Wizards.Host.Alerts.parsing(e.localizedDescription))
alert.addCancelAction(L10n.Global.ok)
root.present(alert, animated: true, completion: nil)
}

View File

@ -47,7 +47,7 @@
"wizards.host.sections.existing.header" = "Existing profiles";
"wizards.host.alerts.existing" = "A host profile with the same title already exists. Replace it?";
"wizards.host.alerts.unsupported" = "The configuration file contains an unsupported option (%@).";
"wizards.host.alerts.parsing" = "Unable to parse the provided configuration file.";
"wizards.host.alerts.parsing" = "Unable to parse the provided configuration file (%@).";
"service.welcome.message" = "Welcome to Passepartout!\n\nUse the organizer to add a new profile.";
"service.sections.general.header" = "General";

View File

@ -666,8 +666,10 @@ internal enum L10n {
internal enum Alerts {
/// A host profile with the same title already exists. Replace it?
internal static let existing = L10n.tr("Localizable", "wizards.host.alerts.existing")
/// Unable to parse the provided configuration file.
internal static let parsing = L10n.tr("Localizable", "wizards.host.alerts.parsing")
/// Unable to parse the provided configuration file (%@).
internal static func parsing(_ p1: String) -> String {
return L10n.tr("Localizable", "wizards.host.alerts.parsing", p1)
}
/// The configuration file contains an unsupported option (%@).
internal static func unsupported(_ p1: String) -> String {
return L10n.tr("Localizable", "wizards.host.alerts.unsupported", p1)