[rubygems/rubygems] Make sure MissingSpecVersionError#to_s prints exception message

Gem command loading errors rely on `#to_s` on the raised exception, but
in the case of `MissingSpecVersionError` that was only the exception
name, making it printed twice and no message at all.

Before:

```
ERROR:  Loading command: install (Gem::MissingSpecVersionError)
 	Gem::MissingSpecVersionError
```

After:

```
ERROR:  Loading command: install (Gem::MissingSpecVersionError)
	Could not find 'io-wait' (>= 0.a) - did find: [io-wait-0.3.0-java]
  Checked in 'GEM_PATH=/Users/deivid/Code/rubygems/rubygems/bundler/tmp/1.1/gems/system' , execute `gem env` for more information
```

https://github.com/rubygems/rubygems/commit/d06944bb2f
This commit is contained in:
David Rodríguez 2024-09-26 15:53:39 +02:00 committed by Hiroshi SHIBATA
parent 02d50d9cb1
commit 49483904d8
No known key found for this signature in database
GPG Key ID: F9CF13417264FAC2

View File

@ -30,6 +30,7 @@ module Gem
@name = name
@requirement = requirement
@extra_message = extra_message
super(message)
end
def message # :nodoc:
@ -53,8 +54,8 @@ module Gem
attr_reader :specs
def initialize(name, requirement, specs)
super(name, requirement)
@specs = specs
super(name, requirement)
end
private