Last active
February 18, 2016 06:53
-
-
Save hvsw/f2271ef8ff7402503c4e 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
func calculate() { | |
do { | |
let x = 2 | |
let y = 2 | |
let result = try divide(x, y) | |
resultLabel.text = String(result) | |
} catch DivisionErrorEnum.DividendIsZero(let code) { | |
print("Your message when the DIVIDEND is zero. \nDetails: Execution failed with code \(code).") | |
} catch DivisionErrorEnum.DivisorIsZero(let code) { | |
print("Your custom message when the DIVISOR is zero. \nDetails: Execution failed with code \(code).") | |
} catch let error { | |
print("Another error occurred. SOS!\n\(error.localizedDescription)”) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment