Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS Error Handling in Swift 2.0 Error Handling Propagation of Errors in Cocoa

Ryan Maneo
Ryan Maneo
4,342 Points

Let me get this strait...

Just to confirm: Enums can be used to hold error types and hold associated values to give a message for the error, then that error is thrown using "throws" in a function, then returned with "throw (error name)" then to use the function we must use do to execute it, then "try" to "try" it, then catch to catch the error and return it with the specific instance of the function, then defer to completely exit the scope of the function once the error has happened.

Is this true? I'm trying to understand everything... but this is definitely confusing me!!!

1 Answer

Everything you've said sounds right to me. I'm still slightly confused on the appropriate times to use deferral, but it doesn't always seem necessary. Correct me if I'm wrong.