mirror of
https://github.com/jphong1111/awesome-ios-developer.git
synced 2024-12-22 21:55:37 +07:00
Update AppError.swift
This commit is contained in:
parent
eb5ed75ae1
commit
9d1f2af3f5
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user