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

Fix UndefVarError due to unintentional signature change #43173

Merged
merged 5 commits into from
Nov 22, 2021
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion base/client.jl
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ end
display_error(stack::ExceptionStack) = display_error(stderr, stack)

# these forms are depended on by packages outside Julia
function display_error(io::IO, exception, backtrace)
function display_error(io::IO, er, bt)
printstyled(io, "ERROR: "; bold=true, color=Base.error_color())
showerror(IOContext(io, :limit => true), er, bt, backtrace = bt!==nothing)
println(io)
Expand Down
2 changes: 2 additions & 0 deletions stdlib/REPL/test/repl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1402,4 +1402,6 @@ fake_repl() do stdin_write, stdout_read, repl
@test readline(stdout_read) == "\e[0m1-element ExceptionStack:"
@test readline(stdout_read) == "UndefVarError: foobar not defined"
@test readline(stdout_read) == "Stacktrace:"
write(stdin_write, '\x04')
Base.wait(repltask)
end
9 changes: 9 additions & 0 deletions test/client.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,12 @@ end
err_str = String(take!(errio))
@test occursin(nested_error_pattern, err_str)
end

@testset "display_error(io, er, bt) works" begin
errio = IOBuffer()
Base.display_error(errio, ErrorException, [])
err_str = String(take!(errio))
@test occursin(r"""
ERROR: ErrorException
"""s, err_str)
end