Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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.