A platform for community discussion. Free, open, simple.
Include response body when raising an error in `FileHelper#download`.
Guo Xiang Tan6c657183012e
diff --git a/lib/file_helper.rb b/lib/file_helper.rbindex f7d2a0907d8..f146b8b139d 100644--- a/lib/file_helper.rb+++ b/lib/file_helper.rb@@ -48,7 +48,7 @@ class FileHelper# attempt error API compatibilityio = FakeIO.newio.status = [response.code, ""]- raise OpenURI::HTTPError.new("#{response.code} Error", io)+ raise OpenURI::HTTPError.new("#{response.code} Error: #{response.body}", io)elselog(:error, "FinalDestination did not work for: #{url}") if verbosethrow :donediff --git a/spec/components/file_helper_spec.rb b/spec/components/file_helper_spec.rbindex ec81a94b575..6baa22ccff1 100644--- a/spec/components/file_helper_spec.rb+++ b/spec/components/file_helper_spec.rb@@ -28,7 +28,7 @@ describe FileHelper doexpect(e.io.status[0]).to eq("404")raiseend- end.to raise_error(OpenURI::HTTPError)+ end.to raise_error(OpenURI::HTTPError, "404 Error: 404")endit "correctly raises an OpenURI HTTP error if it gets a 404" do