Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- enum NetworkRequestError: Error {
- case hostNotAvailable
- case accountNotAvailable
- func finish<T>() -> Result<T, NetworkRequestError> {
- return .failure(self)
- }
- }
- func fetch(result: @escaping (Result<(any: [Any], any1: [Any]), NetworkRequestError>) -> Void) {
- guard host != nil else {
- result(NetworkRequestError.hostNotAvailable.finish())
- return
- }
- ...
- }
- enum NetworkRequestError: Error {
- case hostNotAvailable
- case accountNotAvailable
- }
- func fetch(result: @escaping (Result<(any: [Any], any1: [Any]), NetworkRequestError>) -> Void) {
- guard host != nil else {
- result(.failure(.hostNotAvailable))
- return
- }
- ...
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement