SHARE
TWEET

Untitled

a guest Jun 18th, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. enum NetworkRequestError: Error {
  2.     case hostNotAvailable
  3.     case accountNotAvailable
  4.  
  5.     func finish<T>() -> Result<T, NetworkRequestError> {
  6.         return .failure(self)
  7.     }
  8. }
  9.  
  10. func fetch(result: @escaping (Result<(any: [Any], any1: [Any]), NetworkRequestError>) -> Void) {
  11.     guard host != nil else {
  12.         result(NetworkRequestError.hostNotAvailable.finish())
  13.         return
  14.     }
  15.  
  16.     ...
  17. }
  18.      
  19. enum NetworkRequestError: Error {
  20.     case hostNotAvailable
  21.     case accountNotAvailable
  22. }
  23.  
  24. func fetch(result: @escaping (Result<(any: [Any], any1: [Any]), NetworkRequestError>) -> Void) {
  25.     guard host != nil else {
  26.         result(.failure(.hostNotAvailable))
  27.         return
  28.     }
  29.  
  30.     ...
  31. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top