Advertisement
Guest User

Untitled

a guest
Aug 28th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. import Cocoa
  2.  
  3. var statusCode: String = "401"
  4. var errorString: String
  5. switch statusCode {
  6. case "400", "404":
  7. // If we have a "Bad Request" or "Not Found" error
  8. errorString = "The request was invalid, please double-check your URL"
  9. case "401":
  10. // If we have an "Unauthorized" error
  11. errorString = "Your request failed for reasons of authorization, please check your username and password"
  12. case "403":
  13. // If we have a "Forbidden" error
  14. errorString = "Your request failed since you don't have the necessary permissions, please contact the administrator"
  15. default:
  16. errorString = "Unexpected error of type: \(statusCode)"
  17. }
  18.  
  19. print(errorString)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement