google / promises

Promises is a modern framework that provides a synchronization construct for Swift and Objective-C.
Apache License 2.0
3.79k stars 291 forks source link

Update error checking to use type(of:) rather than typecasting #188

Closed dmace2 closed 2 years ago

dmace2 commented 2 years ago

Verify error status using type(of:) is NSError.Type rather than using as? NSError

This was raised due to iOS 16 String extending Error, meaning any Promise will always return as rejected even if the actual promise code was successful

fix #185

dmace2 commented 2 years ago

Note: This code passed all tests as well as the additional tests located below, which stemmed from the same issue and failed prior to my changes when building against iOS 16 with SafariServices.framework connected to the package

https://github.com/google/promises/issues/88#issuecomment-572834083

dmace2 commented 2 years ago

@ykjchen PR updated with changes