swift2 - Swift 2: Invalid conversion from throwing function of type to non-throwing function -


i have (ugly) self-written code ported swift2 , got error message in lambda function:

function error

what didn't understand is, handle whole code error throwing function jsonobjectwithdata , catch error. throw nothing in code. nevertheless compiler means throwing error.

i need understand behavior. please kind because know have improve code make full use of new error handling concept in swift2.

thank in advance.

this fast. have figured solution problem out little of article:

http://www.hackingwithswift.com/new-syntax-swift-2-error-handling-try-catch

you have put general catch clause @ end of code because catch of nserror alone not sufficient.

catch let error nserror {    failure(error: error)    return }  // important --> catch { } 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -