From a53df954baf95201834ee31feebf557366628b52 Mon Sep 17 00:00:00 2001 From: Vishesh Handa Date: Thu, 17 Jan 2019 14:56:46 +0100 Subject: [PATCH] Sync: Allow the `git pull` to fail On a new repo, the git pull will fail as there isn't any content. We really need to improve the overall error handling. --- lib/storage/git_storage.dart | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/storage/git_storage.dart b/lib/storage/git_storage.dart index c50aa006..d597853f 100644 --- a/lib/storage/git_storage.dart +++ b/lib/storage/git_storage.dart @@ -105,8 +105,18 @@ class GitNoteRepository implements NoteRepository { return true; } - await gitPull(this.dirName); - await gitPush(this.dirName); + try { + await gitPull(this.dirName); + } on GitException catch (ex) { + print(ex); + } + + try { + await gitPush(this.dirName); + } on GitException catch (ex) { + print(ex); + throw ex; + } return true; }