From 15b6cf541205d935b6afd483af79078c14a21215 Mon Sep 17 00:00:00 2001 From: Roopesh Chander Date: Tue, 11 Dec 2018 00:30:33 +0530 Subject: Error handling: alertText() can be nil Indicating that no alert is to be shown for that error. Signed-off-by: Roopesh Chander --- WireGuard/WireGuard/ZipArchive/ZipArchive.swift | 2 +- WireGuard/WireGuard/ZipArchive/ZipExporter.swift | 2 +- WireGuard/WireGuard/ZipArchive/ZipImporter.swift | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'WireGuard/WireGuard/ZipArchive') diff --git a/WireGuard/WireGuard/ZipArchive/ZipArchive.swift b/WireGuard/WireGuard/ZipArchive/ZipArchive.swift index fe633d0..a849daa 100644 --- a/WireGuard/WireGuard/ZipArchive/ZipArchive.swift +++ b/WireGuard/WireGuard/ZipArchive/ZipArchive.swift @@ -8,7 +8,7 @@ enum ZipArchiveError: WireGuardAppError { case cantOpenOutputZipFileForWriting case badArchive - func alertText() -> (String, String) { + func alertText() -> (String, String)? { switch (self) { case .cantOpenInputZipFile: return ("Unable to read zip archive", "The zip archive could not be read.") diff --git a/WireGuard/WireGuard/ZipArchive/ZipExporter.swift b/WireGuard/WireGuard/ZipArchive/ZipExporter.swift index a4e9d7a..4f57613 100644 --- a/WireGuard/WireGuard/ZipArchive/ZipExporter.swift +++ b/WireGuard/WireGuard/ZipArchive/ZipExporter.swift @@ -6,7 +6,7 @@ import UIKit enum ZipExporterError: WireGuardAppError { case noTunnelsToExport - func alertText() -> (String, String) { + func alertText() -> (String, String)? { switch (self) { case .noTunnelsToExport: return ("Nothing to export", "There are no tunnels to export") diff --git a/WireGuard/WireGuard/ZipArchive/ZipImporter.swift b/WireGuard/WireGuard/ZipArchive/ZipImporter.swift index 507a823..d281fb6 100644 --- a/WireGuard/WireGuard/ZipArchive/ZipImporter.swift +++ b/WireGuard/WireGuard/ZipArchive/ZipImporter.swift @@ -6,7 +6,7 @@ import UIKit enum ZipImporterError: WireGuardAppError { case noTunnelsInZipArchive - func alertText() -> (String, String) { + func alertText() -> (String, String)? { switch (self) { case .noTunnelsInZipArchive: return ("No tunnels in zip archive", "No .conf tunnel files were found inside the zip archive.") -- cgit v1.2.3-59-g8ed1b