Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print bug report template to standard error #3924

Merged
merged 1 commit into from Sep 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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