|
|
|
|
@ -7,6 +7,26 @@ |
|
|
|
|
|
|
|
|
|
import Foundation |
|
|
|
|
|
|
|
|
|
public class ErrorUtils { |
|
|
|
|
|
|
|
|
|
public static func message(error: Error) -> String { |
|
|
|
|
switch error { |
|
|
|
|
case ServiceError.responseError(let reason): |
|
|
|
|
return reason |
|
|
|
|
default: |
|
|
|
|
return error.localizedDescription |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public enum ServiceError: Error { |
|
|
|
|
case urlCreationError(url: String) |
|
|
|
|
case cantConvertToUUID(id: String) |
|
|
|
|
case missingUserName |
|
|
|
|
case responseError(response: String) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public enum UUIDError: Error { |
|
|
|
|
case cantConvertString(string: String) |
|
|
|
|
} |
|
|
|
|
|