Обработка ошибок

enum ExceptionError {
    case text
}

func methodWithException() throws {
    do {
        throw Exception.text
    }
    catch {
        //implementation of any partial processing
        //and send error to the calling code
        throw Exception.text
    }
}

do {
    try methodWithException()
}
catch let error {
    print("Exception:", error)
}