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 Throwing Errors

function that can throw. Name this function lend. It takes no parameters and has no return type.

It says make sure i'm "making a function that can throw"

enum BookError: ErrorType {
  case IncorrectTitle

func lend() throws -> BookError {


1 Answer

Jhoan Arango
Jhoan Arango
14,575 Points


You are close, but the challenge does tell you that it has no return type, so just delete the return type you have on yours.

func lend() throws{

Remember the arrow specifies the return type, in this case we are not returning anything, so you don't have to add any returns. If you were to return a string then you would add -> String.

Hope this helps.. good luck

Ah! That worked, thank you!