servo: Merge #10689 - Handle URLError in download() #10679 (from rwakulszowa:bootstrap-disconnected-message); r=Wafflespeanut
authorrwa <rwa@localhost.localdomain>
Tue, 19 Apr 2016 07:54:06 +0500
changeset 338565 59dde21cfc9a017e535cc481b6c5f45285689e3e
parent 338564 ea70c1cf2fb98f54650e076adcf67f236611f414
child 338566 aa9b74a854d5ae7e9046d7f2ab03d4be6058b5a1
push id31307
push usergszorc@mozilla.com
push dateSat, 04 Feb 2017 00:59:06 +0000
treeherdermozilla-central@94079d43835f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersWafflespeanut
servo: Merge #10689 - Handle URLError in download() #10679 (from rwakulszowa:bootstrap-disconnected-message); r=Wafflespeanut Print a human-friendly message if there is no internet connection. Source-Repo: https://github.com/servo/servo Source-Revision: f73c6143d5375db80fd2e0b7de96a99c78b5866b
servo/python/servo/bootstrap_commands.py
--- a/servo/python/servo/bootstrap_commands.py
+++ b/servo/python/servo/bootstrap_commands.py
@@ -58,16 +58,19 @@ def download(desc, src, writer, start_by
                     pct = recved * 100.0 / fsize
                     print("\rDownloading %s: %5.1f%%" % (desc, pct), end="")
 
                 sys.stdout.flush()
             writer.write(chunk)
 
         if not dumb:
             print()
+    except urllib2.URLError:
+        print("Error downloading Rust compiler; are you connected to the internet?")
+        sys.exit(1)
     except urllib2.HTTPError, e:
         print("Download failed (%d): %s - %s" % (e.code, e.reason, src))
         sys.exit(1)
     except KeyboardInterrupt:
         writer.flush()
         raise