Swift: how to handle errors with try-catch?

Example:

func canThrowErrors() throws { /*...*/ }
Error handling in Swift is achieved using try-catch mechanisms.

Solution:

do { try canThrowErrors() } catch { print("An error occurred.") }

Beginner's Guide to Swift