diff --git a/base/experimental.jl b/base/experimental.jl index 555d5e03d667a..648b5da0ed9a1 100644 --- a/base/experimental.jl +++ b/base/experimental.jl @@ -319,9 +319,9 @@ function show_error_hints(io, ex, args...) for handler in hinters try @invokelatest handler(io, ex, args...) - catch err + catch tn = typeof(handler).name - @error "Hint-handler $handler for $(typeof(ex)) in $(tn.module) caused an error" err + @error "Hint-handler $handler for $(typeof(ex)) in $(tn.module) caused an error" exception=current_exceptions() end end end diff --git a/stdlib/REPL/src/REPL.jl b/stdlib/REPL/src/REPL.jl index a2496bbb0d03d..272b907165341 100644 --- a/stdlib/REPL/src/REPL.jl +++ b/stdlib/REPL/src/REPL.jl @@ -75,15 +75,14 @@ function _UndefVarError_warnfor(io::IO, m::Module, var::Symbol) Base.isbindingresolved(m, var) || return false (Base.isexported(m, var) || Base.ispublic(m, var)) || return false active_mod = Base.active_module() - mod_imported = isdefined(active_mod, Symbol(m)) - if !mod_imported && Symbol(m) == var - print(io, "\nHint: $m is loaded but not imported in the active module `$(active_mod)`.") + print(io, "\nHint: ") + if isdefined(active_mod, Symbol(m)) + print(io, "a global variable of this name also exists in $m.") else - print(io, "\nHint: a global variable of this name also exists in $m") - if mod_imported - print(io, ".") + if Symbol(m) == var + print(io, "$m is loaded but not imported in the active module $active_mod.") else - print(io, ", which is loaded but not imported in the active module `$(active_mod)`.") + print(io, "a global variable of this name may be made accessible by importing $m in the current active module $active_mod") end end return true