Skip to content

Commit 0984e42

Browse files
suggestions
Co-Authored-By: Jameson Nash <[email protected]>
1 parent d25c7f1 commit 0984e42

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

base/experimental.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -319,9 +319,9 @@ function show_error_hints(io, ex, args...)
319319
for handler in hinters
320320
try
321321
@invokelatest handler(io, ex, args...)
322-
catch err
322+
catch
323323
tn = typeof(handler).name
324-
@error "Hint-handler $handler for $(typeof(ex)) in $(tn.module) caused an error" err
324+
@error "Hint-handler $handler for $(typeof(ex)) in $(tn.module) caused an error" exception=current_exceptions()
325325
end
326326
end
327327
end

stdlib/REPL/src/REPL.jl

+6-7
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,14 @@ function _UndefVarError_warnfor(io::IO, m::Module, var::Symbol)
7575
Base.isbindingresolved(m, var) || return false
7676
(Base.isexported(m, var) || Base.ispublic(m, var)) || return false
7777
active_mod = Base.active_module()
78-
mod_imported = isdefined(active_mod, Symbol(m))
79-
if !mod_imported && Symbol(m) == var
80-
print(io, "\nHint: $m is loaded but not imported in the active module `$(active_mod)`.")
78+
print(io, "\nHint: ")
79+
if isdefined(active_mod, Symbol(m))
80+
print(io, "a global variable of this name also exists in $m.")
8181
else
82-
print(io, "\nHint: a global variable of this name also exists in $m")
83-
if mod_imported
84-
print(io, ".")
82+
if Symbol(m) == var
83+
print(io, "$m is loaded but not imported in the active module $active_mod.")
8584
else
86-
print(io, ", which is loaded but not imported in the active module `$(active_mod)`.")
85+
print(io, "a global variable of this name may be made accessible by importing $m in the current active module $active_mod")
8786
end
8887
end
8988
return true

0 commit comments

Comments
 (0)