aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2018-11-01 00:45:09 +0530
committerRoopesh Chander <roop@roopc.net>2018-11-01 11:45:44 +0530
commit050f8aa67961f81b76adfa7c5a2768da926c9bc4 (patch)
treefd875646b297b7fae172dcd42ac6b4dda0b506f7
parentVPN: An ErrorPresenter class to consolidate showing of error alerts (diff)
downloadwireguard-apple-050f8aa67961f81b76adfa7c5a2768da926c9bc4.tar.xz
wireguard-apple-050f8aa67961f81b76adfa7c5a2768da926c9bc4.zip
Tunnel edit: Error out on duplicate name when creating / modifying a tunnel
Signed-off-by: Roopesh Chander <roop@roopc.net>
-rw-r--r--WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift8
1 files changed, 3 insertions, 5 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift b/WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift
index a536499..fac2b37 100644
--- a/WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift
+++ b/WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift
@@ -71,14 +71,13 @@ class TunnelEditTableViewController: UITableViewController {
switch (tunnelSaveResult) {
case .error(let errorMessage):
let erroringConfiguration = (tunnelViewModel.interfaceData.validatedConfiguration == nil) ? "Interface" : "Peer"
- showErrorAlert(title: "Invalid \(erroringConfiguration)", message: errorMessage)
+ ErrorPresenter.showErrorAlert(title: "Invalid \(erroringConfiguration)", message: errorMessage, from: self)
case .saved(let tunnelConfiguration):
if let tunnel = tunnel {
// We're modifying an existing tunnel
tunnelsManager.modify(tunnel: tunnel, with: tunnelConfiguration) { [weak self] (error) in
if let error = error {
- print("Could not modify tunnel: \(error)")
- self?.showErrorAlert(title: "Could not save", message: "Internal error")
+ ErrorPresenter.showErrorAlert(error: error, from: self)
} else {
self?.dismiss(animated: true, completion: nil)
self?.delegate?.tunnelSaved(tunnel: tunnel)
@@ -88,8 +87,7 @@ class TunnelEditTableViewController: UITableViewController {
// We're adding a new tunnel
tunnelsManager.add(tunnelConfiguration: tunnelConfiguration) { [weak self] (tunnel, error) in
if let error = error {
- print("Could not add tunnel: \(error)")
- self?.showErrorAlert(title: "Could not save", message: "Internal error")
+ ErrorPresenter.showErrorAlert(error: error, from: self)
} else {
self?.dismiss(animated: true, completion: nil)
if let tunnel = tunnel {