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 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!