[tor-commits] [snowflake/master] Update try catch blocks to revert changes on error

cohosh at torproject.org cohosh at torproject.org
Wed Oct 16 14:24:46 UTC 2019


commit f74da6e0fc32354e1c37d28189af2c8fa039c88c
Author: Cecylia Bocovich <cohosh at torproject.org>
Date:   Tue Oct 15 12:50:04 2019 -0400

    Update try catch blocks to revert changes on error
    
    A failure to set the git tag returns and undoes the changes done
    previously
---
 proxy/make.js | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/proxy/make.js b/proxy/make.js
index 9f8b6bb..bbaf0ca 100755
--- a/proxy/make.js
+++ b/proxy/make.js
@@ -117,6 +117,7 @@ task('pack-webext', 'pack the webextension for deployment', function() {
     execSync(`rm -f source.zip`);
     execSync(`rm -f webext/webext.zip`);
   } catch (error) {
+    //Usually this happens because the zip files were removed previously
     console.log('Error removing zip files');
   }
   execSync(`git submodule update --remote`);
@@ -130,6 +131,11 @@ task('pack-webext', 'pack the webextension for deployment', function() {
     execSync(`git tag webext-${version}`);
   } catch (error) {
     console.log('Error creating git tag');
+    // Revert changes
+    execSync(`git reset HEAD~`);
+    execSync(`git checkout ./webext/manifest.json`);
+    execSync(`git submodule update`);
+    return;
   }
   execSync(`git archive -o source.zip HEAD .`);
   execSync(`npm run webext`);



More information about the tor-commits mailing list