Skip to content

Commit 4bad8de

Browse files
committed
Rename InvalidFileNameError to InvalidWindowsFileNameError for clarity
1 parent d35f4b8 commit 4bad8de

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lib/rubygems/package.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class TarInvalidError < Error; end
9292
##
9393
# Raised when a filename contains characters that are invalid on Windows
9494

95-
class InvalidFileNameError < Error
95+
class InvalidWindowsFileNameError < Error
9696
def initialize(filename, gem_name = nil)
9797
message = "The gem contains a file '#{filename}' with characters in its name that are not allowed on Windows (e.g., colons)."
9898
message += " This is a problem with the '#{gem_name}' gem, not Rubygems." if gem_name
@@ -445,7 +445,7 @@ def extract_tar_gz(io, destination_dir, pattern = "*") # :nodoc:
445445

446446
if invalid_windows_filename?(full_name)
447447
gem_name = @spec ? @spec.full_name : "unknown"
448-
raise Gem::Package::InvalidFileNameError.new(full_name, gem_name)
448+
raise Gem::Package::InvalidWindowsFileNameError.new(full_name, gem_name)
449449
end
450450

451451
if entry.symlink?
@@ -480,9 +480,9 @@ def extract_tar_gz(io, destination_dir, pattern = "*") # :nodoc:
480480
out.flush
481481
out.chmod file_mode(entry.header.mode) & ~File.umask
482482
end
483-
rescue Errno::EINVAL => e
483+
rescue Errno::EINVAL
484484
gem_name = @spec ? @spec.full_name : "unknown"
485-
raise Gem::Package::InvalidFileNameError.new(full_name, gem_name), e.message
485+
raise Gem::Package::InvalidWindowsFileNameError.new(full_name, gem_name)
486486
end
487487
end
488488

test/rubygems/test_gem_package.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,7 +1316,7 @@ def test_invalid_windows_filename
13161316
end
13171317

13181318
def test_invalid_file_name_error_message
1319-
error = Gem::Package::InvalidFileNameError.new("spec/internal/:memory", "crono-2.0.1")
1319+
error = Gem::Package::InvalidWindowsFileNameError.new("spec/internal/:memory", "crono-2.0.1")
13201320
assert_match(%r{The gem contains a file 'spec/internal/:memory'}, error.message)
13211321
assert_match(/characters in its name that are not allowed on Windows/, error.message)
13221322
assert_match(/This is a problem with the 'crono-2.0.1' gem, not Rubygems/, error.message)
@@ -1335,7 +1335,7 @@ def test_extract_tar_gz_invalid_filename
13351335
end
13361336
end
13371337

1338-
e = assert_raise Gem::Package::InvalidFileNameError do
1338+
e = assert_raise Gem::Package::InvalidWindowsFileNameError do
13391339
package.extract_tar_gz tgz_io, @destination
13401340
end
13411341

0 commit comments

Comments
 (0)