Skip to content

Commit fc2d3af

Browse files
precompilepkgs: fix error reporting (#53862)
1 parent 653c0ae commit fc2d3af

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

base/precompilation.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,8 @@ struct PkgPrecompileError <: Exception
333333
msg::String
334334
end
335335
Base.showerror(io::IO, err::PkgPrecompileError) = print(io, err.msg)
336+
Base.showerror(io::IO, err::PkgPrecompileError, bt; kw...) = Base.showerror(io, err) # hide stacktrace
337+
336338
# This needs a show method to make `julia> err` show nicely
337339
Base.show(io::IO, err::PkgPrecompileError) = print(io, "PkgPrecompileError: ", err.msg)
338340

@@ -821,7 +823,7 @@ function precompilepkgs(pkgs::Vector{String}=String[];
821823
close(std_pipe.in) # close pipe to end the std output monitor
822824
wait(t_monitor)
823825
if err isa ErrorException || (err isa ArgumentError && startswith(err.msg, "Invalid header in cache file"))
824-
failed_deps[pkg_config] = (strict || is_direct_dep) ? string(sprint(showerror, err), "\n", strip(get(std_outputs, pkg, ""))) : ""
826+
failed_deps[pkg_config] = (strict || is_direct_dep) ? string(sprint(showerror, err), "\n", strip(get(std_outputs, pkg_config, ""))) : ""
825827
delete!(std_outputs, pkg_config) # so it's not shown as warnings, given error report
826828
!fancyprint && lock(print_lock) do
827829
println(io, " "^9, color_string("", Base.error_color()), name)
@@ -944,7 +946,7 @@ function precompilepkgs(pkgs::Vector{String}=String[];
944946
end
945947
else
946948
println(io)
947-
error(err_msg)
949+
throw(PkgPrecompileError(err_msg))
948950
end
949951
end
950952
end

0 commit comments

Comments
 (0)