Archived
1
This commit is contained in:
Kim Wittenburg
2019-02-01 22:59:01 +01:00
parent ba472864df
commit 0a485ff42a
82 changed files with 3975 additions and 1822 deletions

6
TagTunes/DescriptiveError.swift Normal file → Executable file
View File

@@ -9,7 +9,7 @@
import Foundation
/// A custom error class that wraps another error to display a more descriptive
/// error description than for example "The operation couldn't be completed."
/// error description than for example "The operation couldn't be completed".
public class DescriptiveError: NSError {
/// Initializes the receiver with the specified `underlyingError`.
@@ -34,6 +34,8 @@ public class DescriptiveError: NSError {
override public var localizedDescription: String {
if domain == NSURLErrorDomain {
switch code {
case NSURLErrorCannotConnectToHost:
fallthrough
case NSURLErrorNotConnectedToInternet:
return NSLocalizedString("You are not connected to the internet.", comment: "Error message informing the user that he is not connected to the internet.")
case NSURLErrorTimedOut:
@@ -47,6 +49,8 @@ public class DescriptiveError: NSError {
override public var localizedRecoverySuggestion: String? {
if domain == NSURLErrorDomain {
switch code {
case NSURLErrorCannotConnectToHost:
fallthrough
case NSURLErrorNotConnectedToInternet:
return NSLocalizedString("Please check your network connection and try again.", comment: "Error recovery suggestion for 'not connected to the internet' error.")
case NSURLErrorTimedOut: