зеркало из https://github.com/github/ruby.git
[rubygems/rubygems] Improve gzip errors logging
By default, the `Zlib::GzipFile::Error` does not include the actual data that was not in gzip format that caused the error. However, its `#inspect` method includes it. I think this can be helpful to troubleshoot errors. https://github.com/rubygems/rubygems/commit/11c8717133
This commit is contained in:
Родитель
b24f7dbcfd
Коммит
5df6082786
|
@ -11,7 +11,13 @@ module Gem::Util
|
|||
require 'stringio'
|
||||
data = StringIO.new(data, 'r')
|
||||
|
||||
unzipped = Zlib::GzipReader.new(data).read
|
||||
gzip_reader = begin
|
||||
Zlib::GzipReader.new(data)
|
||||
rescue Zlib::GzipFile::Error => e
|
||||
raise e.class, e.inspect, e.backtrace
|
||||
end
|
||||
|
||||
unzipped = gzip_reader.read
|
||||
unzipped.force_encoding Encoding::BINARY
|
||||
unzipped
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче