Ethan Huang

Some Error can be catch but not thrown in Swift

There are SKError/HKError in StoreKit/HealthKit. They have errorCode, errorUserInfo, and errorDomain, which means they could conform to CustomNSError. You can catch them, but to throw them as Swift Error, you need to “extension SKError/HKError: Error { }” youself.

Why? 🤔

Sample code is here.