diff options
| author | Andre Arko <andre@arko.net> | 2015-12-13 20:05:11 +0800 |
|---|---|---|
| committer | Andre Arko <andre@arko.net> | 2015-12-13 20:05:11 +0800 |
| commit | 0113309648da399e59f9ea67a0500af49818ed7b (patch) | |
| tree | 061b7a74af49a0921785e852215ab4cb4642dedb | |
| parent | 7e466f3d31cac3b62b84d57c1eebb2dcde82a2c7 (diff) | |
| download | bundler-0113309648da399e59f9ea67a0500af49818ed7b.tar.gz | |
YamlLibrarySyntaxError != YamlsyntayxError
It’s really confusing to have two constants that only differ by
capitalization. One is the library error, one is Bundler’s own, so let’s
name them that way.
| -rw-r--r-- | lib/bundler.rb | 2 | ||||
| -rw-r--r-- | lib/bundler/errors.rb | 2 | ||||
| -rw-r--r-- | lib/bundler/friendly_errors.rb | 2 | ||||
| -rw-r--r-- | lib/bundler/psyched_yaml.rb | 4 | ||||
| -rw-r--r-- | lib/bundler/rubygems_integration.rb | 4 |
5 files changed, 7 insertions, 7 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb index be90b0628e..6df517302c 100644 --- a/lib/bundler.rb +++ b/lib/bundler.rb @@ -375,7 +375,7 @@ module Bundler # If the YAML is invalid, Syck raises an ArgumentError, and Psych # raises a Psych::SyntaxError. See psyched_yaml.rb for more info. Gem::Specification.from_yaml(contents) - rescue YamlSyntaxError, ArgumentError, Gem::EndOfYAMLException, Gem::Exception + rescue YamlLibrarySyntaxError, ArgumentError, Gem::EndOfYAMLException, Gem::Exception eval_gemspec(path, contents) end diff --git a/lib/bundler/errors.rb b/lib/bundler/errors.rb index 0ed59017b8..75c8c90b88 100644 --- a/lib/bundler/errors.rb +++ b/lib/bundler/errors.rb @@ -69,7 +69,7 @@ module Bundler status_code(23) end - class YAMLSyntaxError < BundlerError + class YamlSyntaxError < BundlerError attr_reader :orig_exception def initialize(orig_exception, msg) diff --git a/lib/bundler/friendly_errors.rb b/lib/bundler/friendly_errors.rb index eb15f48071..5721807a90 100644 --- a/lib/bundler/friendly_errors.rb +++ b/lib/bundler/friendly_errors.rb @@ -5,7 +5,7 @@ require "bundler/vendored_thor" module Bundler def self.with_friendly_errors yield - rescue YAMLSyntaxError => e + rescue Bundler::YamlSyntaxError => e Bundler.ui.error e.message Bundler.ui.trace e.orig_exception exit e.status_code diff --git a/lib/bundler/psyched_yaml.rb b/lib/bundler/psyched_yaml.rb index 46398057b9..429cdb85f2 100644 --- a/lib/bundler/psyched_yaml.rb +++ b/lib/bundler/psyched_yaml.rb @@ -19,8 +19,8 @@ module Bundler # On encountering invalid YAML, # Psych raises Psych::SyntaxError if defined?(::Psych::SyntaxError) - YamlSyntaxError = ::Psych::SyntaxError + YamlLibrarySyntaxError = ::Psych::SyntaxError else # Syck raises ArgumentError - YamlSyntaxError = ::ArgumentError + YamlLibrarySyntaxError = ::ArgumentError end end diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb index 96b9101610..e5bd850743 100644 --- a/lib/bundler/rubygems_integration.rb +++ b/lib/bundler/rubygems_integration.rb @@ -68,8 +68,8 @@ module Bundler Bundler.ui.error "#{e.class}: #{e.message}" Bundler.ui.trace e raise - rescue YamlSyntaxError => e - raise YAMLSyntaxError.new(e, "Your RubyGems configuration, which is " \ + rescue YamlLibrarySyntaxError => e + raise YamlSyntaxError.new(e, "Your RubyGems configuration, which is " \ "usually located in ~/.gemrc, contains invalid YAML syntax.") end |
