Commits

David Warburton committed 4d36691

push failure handling.

  • Participants
  • Parent commits 296cf51

Comments (0)

Files changed (1)

 
         req = urllib2.Request(url=assets_url, data=assets_data, headers=addheaders)
         req.get_method = lambda: 'PUT'
-        response = opener.open(req)
-        print response.code
-
-        return response
-
+        success = True
+        try:
+            opener.open(req)
+        except urllib2.HTTPError:
+            success = False
+        return success
 
 class ShopifyShowStoresCommand(sublime_plugin.WindowCommand):
     def run(self):
         with open(self.filename, 'rb') as f:
             value = f.read()
         
-        store.push_asset(self.key, self.theme_id, value)
-        sublime.set_timeout(lambda:sublime.status_message(''),0)
+        success = store.push_asset(self.key, self.theme_id, value)
+        if (success):
+            sublime.set_timeout(lambda:sublime.status_message("Upload to %s is successful" % store.display_name),0)
+        else:
+            sublime.set_timeout(lambda:sublime.status_message("Upload to %s has failed" % store.display_name),0)
         self.result = True
 
 load()