From 09d956e74f1ac3a576fe335ba9417e250c2ca3cc Mon Sep 17 00:00:00 2001 From: Maria Nashchanskaia Date: Thu, 28 Sep 2017 13:01:38 +0200 Subject: [PATCH 1/2] reportError method --- ios/RCTAppMetrica/RCTAppMetrica/RCTAppMetrica.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ios/RCTAppMetrica/RCTAppMetrica/RCTAppMetrica.m b/ios/RCTAppMetrica/RCTAppMetrica/RCTAppMetrica.m index 3746181..40f6b63 100644 --- a/ios/RCTAppMetrica/RCTAppMetrica/RCTAppMetrica.m +++ b/ios/RCTAppMetrica/RCTAppMetrica/RCTAppMetrica.m @@ -22,4 +22,8 @@ RCT_EXPORT_METHOD(reportEvent:(NSString *)message parameters:(nullable NSDiction [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 From a0d55b9f3c2ee13cbc318055ccb85f7fb4e5ee11 Mon Sep 17 00:00:00 2001 From: Maria Nashchanskaia Date: Thu, 28 Sep 2017 14:06:30 +0200 Subject: [PATCH 2/2] reportError in js --- index.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/index.js b/index.js index ecea787..5518929 100644 --- a/index.js +++ b/index.js @@ -19,4 +19,13 @@ export default { reportEvent(message, params = null) { AppMetrica.reportEvent(message, params); }, + + /** + * Sends error with reason. + * @param {string} error + * @param {object} reason + */ + reportError(error, reason) { + AppMetrica.reportError(error, reason); + }, };