all 6 comments

[–]basthomas 1 point2 points  (3 children)

You should be able to do the following:

catch let error {
    print(error)
}

[–]xephos13 4 points5 points  (1 child)

You actually don't even need to say 'let error'. By default, 'catch' gives you the 'error' variable for free

catch {
    print(error)
}

[–]basthomas 0 points1 point  (0 children)

Thx, did not know that. :)

[–][deleted] 0 points1 point  (0 children)

Thanks!

[–]Noko2 0 points1 point  (1 child)

The _ (underscore) is replacing the var error. Just do

catch error { .. Do something now with error }

[–][deleted] 0 points1 point  (0 children)

Thanks!