Skip to content

Commit 08c4987

Browse files
IanButterworthKristofferC
authored andcommitted
precompilepkgs: fix error reporting (#53862)
(cherry picked from commit fc2d3af)
1 parent 3cc6c5c commit 08c4987

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
@@ -331,6 +331,8 @@ struct PkgPrecompileError <: Exception
331331
msg::String
332332
end
333333
Base.showerror(io::IO, err::PkgPrecompileError) = print(io, err.msg)
334+
Base.showerror(io::IO, err::PkgPrecompileError, bt; kw...) = Base.showerror(io, err) # hide stacktrace
335+
334336
# This needs a show method to make `julia> err` show nicely
335337
Base.show(io::IO, err::PkgPrecompileError) = print(io, "PkgPrecompileError: ", err.msg)
336338

@@ -812,7 +814,7 @@ function precompilepkgs(pkgs::Vector{String}=String[];
812814
close(std_pipe.in) # close pipe to end the std output monitor
813815
wait(t_monitor)
814816
if err isa ErrorException || (err isa ArgumentError && startswith(err.msg, "Invalid header in cache file"))
815-
failed_deps[pkg_config] = (strict || is_direct_dep) ? string(sprint(showerror, err), "\n", strip(get(std_outputs, pkg, ""))) : ""
817+
failed_deps[pkg_config] = (strict || is_direct_dep) ? string(sprint(showerror, err), "\n", strip(get(std_outputs, pkg_config, ""))) : ""
816818
delete!(std_outputs, pkg_config) # so it's not shown as warnings, given error report
817819
!fancyprint && lock(print_lock) do
818820
println(io, " "^9, color_string("", Base.error_color()), name)
@@ -935,7 +937,7 @@ function precompilepkgs(pkgs::Vector{String}=String[];
935937
end
936938
else
937939
println(io)
938-
error(err_msg)
940+
throw(PkgPrecompileError(err_msg))
939941
end
940942
end
941943
end

0 commit comments

Comments
 (0)