Merge pull request #2 from 10levels/master

reportError method for iOS
This commit is contained in:
Aleksei Androsov 2017-09-29 12:40:32 +03:00 committed by GitHub
commit fcd209f43c
2 changed files with 13 additions and 0 deletions

View File

@ -19,4 +19,13 @@ export default {
reportEvent(message, params = null) { reportEvent(message, params = null) {
AppMetrica.reportEvent(message, params); AppMetrica.reportEvent(message, params);
}, },
/**
* Sends error with reason.
* @param {string} error
* @param {object} reason
*/
reportError(error, reason) {
AppMetrica.reportError(error, reason);
},
}; };

View File

@ -22,4 +22,8 @@ RCT_EXPORT_METHOD(reportEvent:(NSString *)message parameters:(nullable NSDiction
[YMMYandexMetrica reportEvent:message parameters:params onFailure:NULL]; [YMMYandexMetrica reportEvent:message parameters:params onFailure:NULL];
} }
RCT_EXPORT_METHOD(reportError:(NSString *)message reason:(NSString *)reason) {
NSException *exception = [[NSException alloc] initWithName:message reason:reason userInfo:nil];
[YMMYandexMetrica reportError:message exception:exception onFailure:NULL];
}
@end @end