SimpleX-Chat/apps/ios/SimpleXChat/objc.m
Evgeny 0cb568d206
fix incorrect error of migration to device (#4852)
* fix incorrect error of migration to device

* alert to finish migration, ios fix

* simplexmq

* catching exception and stopping chat

* text

---------

Co-authored-by: Avently <7953703+avently@users.noreply.github.com>
2024-09-09 15:01:18 +01:00

25 lines
545 B
Objective-C

//
// objc.m
// SimpleXChat
//
// Created by Stanislav Dmitrenko on 09.09.2024.
// Copyright © 2024 SimpleX Chat. All rights reserved.
//
#import "objc.h"
@implementation ObjC
// https://stackoverflow.com/a/36454808
+ (BOOL)catchException:(void(^)(void))tryBlock error:(__autoreleasing NSError **)error {
@try {
tryBlock();
return YES;
}
@catch (NSException *exception) {
*error = [[NSError alloc] initWithDomain: exception.name code: 0 userInfo: exception.userInfo];
return NO;
}
}
@end