Wrap sync-ing attemts inside a try-catch block to avoid uncaught errors
This commit is contained in:
parent
baeb54f534
commit
4d77ccc8ba
1 changed files with 11 additions and 4 deletions
|
@ -28,8 +28,7 @@ void _main() async {
|
|||
|
||||
await Configuration.instance.init();
|
||||
FavoritePhotosRepository.instance.init();
|
||||
PhotoSyncManager.instance.sync();
|
||||
FolderSharingService.instance.sync();
|
||||
_sync();
|
||||
|
||||
final SentryClient sentry = new SentryClient(dsn: SENTRY_DSN);
|
||||
|
||||
|
@ -45,6 +44,15 @@ void _main() async {
|
|||
);
|
||||
}
|
||||
|
||||
void _sync() async {
|
||||
try {
|
||||
await PhotoSyncManager.instance.sync();
|
||||
await FolderSharingService.instance.sync();
|
||||
} catch (e) {
|
||||
logger.warning(e);
|
||||
}
|
||||
}
|
||||
|
||||
void _sendErrorToSentry(SentryClient sentry, Object error, StackTrace stack) {
|
||||
logger.shout("Uncaught error", error, stack);
|
||||
try {
|
||||
|
@ -75,8 +83,7 @@ class MyApp extends StatelessWidget with WidgetsBindingObserver {
|
|||
@override
|
||||
void didChangeAppLifecycleState(AppLifecycleState state) {
|
||||
if (state == AppLifecycleState.resumed) {
|
||||
PhotoSyncManager.instance.sync();
|
||||
FolderSharingService.instance.sync();
|
||||
_sync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue