Update AppError.swift

This commit is contained in:
Jungpyo Hong 2021-05-19 23:17:13 -05:00 committed by GitHub
parent eb5ed75ae1
commit 9d1f2af3f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,33 +5,56 @@
//
// Created by JungpyoHong on 5/4/21.
//
import Foundation
enum AppError: Error {
case badUrl
case badResponse
case serverError
case badResponse
case noData
case parseError
case badRequest
case genericError(String)
case parametersNil
case encodingFail
case unauthorizedLocationAccess
case copyError
var errorMessage: String {
switch self {
case .badUrl:
return ""
case .badResponse:
return ""
return "URL is not valid"
case .serverError:
return ""
return "Server Error"
case .badResponse:
return "Bad HTTP response"
case .noData:
return ""
case .badRequest:
return ""
return "No data found"
case .parseError:
return ""
return "Parsing Error"
case .badRequest:
return "Bad Request"
case .genericError(let message):
return message
case .parametersNil:
return "Parameters were nil."
case .encodingFail:
return "Parameter encoding fail."
case .unauthorizedLocationAccess:
return "Unauthorized Location Access"
case .copyError:
return "Unable to copy file"
}
}
}