How to convert an exception into an NSError object
问题 I want to convert the message of an exception into an NSError object so that I can use it within a try-catch block (I'm actually working on a native iOS module for React Native). RCT_EXPORT_METHOD(myMethod:(NSDictionary *)dict resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) { @try { // Do something which could throw something (NS Error or NS Exception) resolve(nil); } @catch (NSException *exception) { // HERE I WANT TO TRANSFORM THE EXCEPTION exception INTO AN