Explorar el Código

prepare_deploy: report which download has failed

Simon Legner hace 5 años
padre
commit
959f51e6f7
Se han modificado 1 ficheros con 10 adiciones y 4 borrados
  1. 10 4
      lib/tasks/docs.thor

+ 10 - 4
lib/tasks/docs.thor

@@ -244,11 +244,17 @@ class DocsCLI < Thor
           FileUtils.mkpath(dir)
 
           ['index.json', 'meta.json'].each do |filename|
-            open("https://docs.devdocs.io/#{doc.path}/#{filename}?#{time}") do |file|
-              mutex.synchronize do
-                path = File.join(dir, filename)
-                File.write(path, file.read)
+            json = "https://docs.devdocs.io/#{doc.path}/#{filename}?#{time}"
+            begin
+              open(json) do |file|
+                mutex.synchronize do
+                  path = File.join(dir, filename)
+                  File.write(path, file.read)
+                end
               end
+            rescue => e
+              puts "Docs -- Failed to download #{json}!"
+              throw e
             end
           end