PromiseKit with Swift: terminate chain of promises

Change it to:

firstly {
    // ...
}.then { obj -> Void in
    self.handleResult(obj)
    self.doSomethingDifferent(obj)
}.catch { error in
    self.handleError(error)
}

According to http://promisekit.org/PromiseKit-2.0-Released/, under Swift Compiler Issues section:

The Swift compiler will often error with then. To figure out the issue, first try specifying the full signature for your closures:

foo.then { x in
    doh()
    return bar()
}

// will need to be written as:

foo.then { obj -> Promise<Type> in
    doh()
    return bar()
}

// Because the Swift compiler cannot infer closure types very
// well yet. We hope this will be fixed.

// Watch out for  one-line closures though! Swift will
// automatically infer the types, which may confuse you:

foo.then {
    return bar()
}

So you'll have to change your code to:

firstly {
    // ...
}.then { obj -> Promise<WhateverTypeDoSomethingDifferentPromises> in
    self.handleResult(obj)
    self.doSomethingDifferent(obj)
}.catch { error in
    self.handleError(error)
}

Or you can use obj -> Void to stop the chain