Open cojoj opened 8 years ago
Can you provide an example? AFAIK, all our APIs are asynchronous, so the callback block is called much later after the call of the API method. Throw only works with synchronous calls.
What we could do is change the signature from NSError
to ErrorType
. That would be a good improvement, because it would allow for error enum types.
Right, async... And I'm back home 😉 But we have more methods which may be considered this way eg. createRequest()
returns NSMutableRequest?
.
Anyway, ErrorTypes
sounds great!
Yup, createRequest()
would be a good candidate for throw
ing.
Action: look into changing the error type in API call block callbacks from NSError
to ErrorType
.
Right now most of our API endpoint methods (these located in
XcodeServer
extension
s) are constructed in non-swifty way - they return optionalNSError
pointers.How about gradually changing them to
throw
ing methods? There are some benefits of doing this:Optional
senum
sI know, I know, I may be overreacting... Maybe that's because I have too much free time? 😝