lib/bundler/friendly_errors.rb in bundler-2.2.0.rc.2 vs lib/bundler/friendly_errors.rb in bundler-2.2.0

- old
+ new

@@ -4,10 +4,22 @@ module Bundler module FriendlyErrors module_function + def enable! + @disabled = false + end + + def disabled? + @disabled + end + + def disable! + @disabled = true + end + def log_error(error) case error when YamlSyntaxError Bundler.ui.error error.message Bundler.ui.trace error.orig_exception @@ -112,13 +124,16 @@ "#{CGI.escape(message)}&type=Issues" end end def self.with_friendly_errors + FriendlyErrors.enable! yield rescue SignalException raise rescue Exception => e # rubocop:disable Lint/RescueException + raise if FriendlyErrors.disabled? + FriendlyErrors.log_error(e) exit FriendlyErrors.exit_status(e) end end