diff --git a/src/parser_api.jl b/src/parser_api.jl index fb805aa7..95f077ef 100644 --- a/src/parser_api.jl +++ b/src/parser_api.jl @@ -16,13 +16,16 @@ function ParseError(stream::ParseStream; incomplete_tag=:none, kws...) end function Base.showerror(io::IO, err::ParseError) - println(io, "ParseError:") # Only show the first parse error for now - later errors are often # misleading due to the way recovery works i = findfirst(is_error, err.diagnostics) if isnothing(i) i = lastindex(err.diagnostics) + level_info = " some warnings detected:" + else + level_info = "" end + println(io, "ParseError:", level_info) show_diagnostics(io, err.diagnostics[1:i], err.source) end diff --git a/test/parser_api.jl b/test/parser_api.jl index 9e05dee1..11570ce9 100644 --- a/test/parser_api.jl +++ b/test/parser_api.jl @@ -163,7 +163,7 @@ end catch exc @test exc isa JuliaSyntax.ParseError @test sprint(showerror, exc) == """ - ParseError: + ParseError: some warnings detected: # Warning @ somefile.jl:1:2 @(a) #└─┘ ── parenthesizing macro names is unnecessary"""