Skip to content

Commit

Permalink
Merge pull request #3924 from rubygems/bug_report_template_to_standar…
Browse files Browse the repository at this point in the history
…d_error

The bug report template should be printed to standard error

(cherry picked from commit 44388bf)
  • Loading branch information
deivid-rodriguez committed Oct 5, 2020
1 parent d3c0ca8 commit a2418d0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions bundler/lib/bundler/friendly_errors.rb
Expand Up @@ -51,7 +51,7 @@ def exit_status(error)
end

def request_issue_report_for(e)
Bundler.ui.info <<-EOS.gsub(/^ {8}/, "")
Bundler.ui.error <<-EOS.gsub(/^ {8}/, ""), nil, nil
--- ERROR REPORT TEMPLATE -------------------------------------------------------
# Error Report
Expand Down Expand Up @@ -94,7 +94,7 @@ def request_issue_report_for(e)

Bundler.ui.error "Unfortunately, an unexpected error occurred, and Bundler cannot continue."

Bundler.ui.warn <<-EOS.gsub(/^ {8}/, "")
Bundler.ui.error <<-EOS.gsub(/^ {8}/, ""), nil, :yellow
First, try this link to see if there are any existing issue reports for this error:
#{issues_url(e)}
Expand Down
8 changes: 4 additions & 4 deletions bundler/lib/bundler/ui/shell.rb
Expand Up @@ -28,17 +28,17 @@ def confirm(msg, newline = nil)
tell_me(msg, :green, newline) if level("confirm")
end

def warn(msg, newline = nil)
def warn(msg, newline = nil, color = :yellow)
return unless level("warn")
return if @warning_history.include? msg
@warning_history << msg

tell_err(msg, :yellow, newline)
tell_err(msg, color, newline)
end

def error(msg, newline = nil)
def error(msg, newline = nil, color = :red)
return unless level("error")
tell_err(msg, :red, newline)
tell_err(msg, color, newline)
end

def debug(msg, newline = nil)
Expand Down
6 changes: 3 additions & 3 deletions bundler/spec/bundler/friendly_errors_spec.rb
Expand Up @@ -193,9 +193,9 @@ class OutOfMemoryError < StandardError; end

describe "#request_issue_report_for" do
it "calls relevant methods for Bundler.ui" do
expect(Bundler.ui).to receive(:info)
expect(Bundler.ui).to receive(:error)
expect(Bundler.ui).to receive(:warn)
expect(Bundler.ui).not_to receive(:info)
expect(Bundler.ui).to receive(:error).exactly(3).times
expect(Bundler.ui).not_to receive(:warn)
Bundler::FriendlyErrors.request_issue_report_for(StandardError.new)
end

Expand Down

0 comments on commit a2418d0

Please sign in to comment.