Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

ios: log fatal errors, don't swallow exceptions

Saúl Ibarra Corretgéf2fdef836165
diff --git a/ios/sdk/src/JitsiMeet.m b/ios/sdk/src/JitsiMeet.m
index 8dd34dfd3b..9bfc9537ad 100644
--- a/ios/sdk/src/JitsiMeet.m
+++ b/ios/sdk/src/JitsiMeet.m
@@ -51,6 +51,9 @@
// Register a fatal error handler for React.
registerReactFatalErrorHandler();
+
+ // Register a log handler for React.
+ registerReactLogHanler();
}
return self;
diff --git a/ios/sdk/src/ReactUtils.h b/ios/sdk/src/ReactUtils.h
index f80028f82f..327e6eaa19 100644
--- a/ios/sdk/src/ReactUtils.h
+++ b/ios/sdk/src/ReactUtils.h
@@ -19,5 +19,6 @@
NSMutableDictionary* mergeProps(NSDictionary *a, NSDictionary *b);
void registerReactFatalErrorHandler(void);
+void registerReactLogHandler(void);
#endif /* JM_REACTUTILS_H */
diff --git a/ios/sdk/src/ReactUtils.m b/ios/sdk/src/ReactUtils.m
index da1daa2503..fc12246bc1 100644
--- a/ios/sdk/src/ReactUtils.m
+++ b/ios/sdk/src/ReactUtils.m
@@ -15,7 +15,9 @@
*/
#import <React/RCTAssert.h>
+#import <React/RCTLog.h>
+#import "LogUtils.h"
#import "ReactUtils.h"
#pragma mark - Utility functions
@@ -67,19 +69,11 @@ NSMutableDictionary* mergeProps(NSDictionary *a, NSDictionary *b) {
*/
RCTFatalHandler _RCTFatal = ^(NSError *error) {
id jsStackTrace = error.userInfo[RCTJSStackTraceKey];
- @try {
- NSString *name
- = [NSString stringWithFormat:@"%@: %@",
- RCTFatalExceptionName,
- error.localizedDescription];
- NSString *message
- = RCTFormatError(error.localizedDescription, jsStackTrace, 75);
- [NSException raise:name format:@"%@", message];
- } @catch (NSException *e) {
- if (!jsStackTrace) {
- @throw;
- }
- }
+ NSString *name
+ = [NSString stringWithFormat:@"%@: %@", RCTFatalExceptionName, error.localizedDescription];
+ NSString *message
+ = RCTFormatError(error.localizedDescription, jsStackTrace, -1);
+ DDLogError(@"FATAL ERROR: %@\n%@", name, message);
};
/**