Created
July 28, 2021 04:58
-
-
Save KalpeshTalkar/8f64bcc775bc0adab8811cac7ccdd9ff to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// APIServiceError.swift | |
// | |
// Copyright © 2021 Kalpesh Talkar. All rights reserved. | |
// | |
import Foundation | |
public struct APIServiceError: LocalizedError { | |
let message: String? | |
let code: Int? | |
public var errorDescription: String? { | |
return message | |
} | |
public var failureReason: String? { | |
return message | |
} | |
public static func genericError() -> APIServiceError { | |
return APIServiceError(message: "Oops! Something is not right. Please try again later.", code: 900) | |
} | |
static func invalidUrlError() -> APIServiceError { | |
return APIServiceError(message: "Invalid URL.", code: 902) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment