alibaba/coobjc

Why does the param of COPromiseReject is an object of NSError instead of NSException?

CallmeLetty opened this issue · 1 comments

Is your feature request related to a problem? Please describe.
If we use the object of NSExcetion as the param of COPromiseReject,we can use "try..catch" to get something wrong,which is more convienient.

Describe the solution you'd like
Change the param of COPromiseReject to an object of NSException.

In Objective-C, Exceptions use for some cases unrecoverable. As knowns, apple's objc guide do not suggest using "try..catch"。

Using try..catch may cause leak: https://stackoverflow.com/questions/4648952/objective-c-exceptions

That's why we use errors.