diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d6c3c46023..a0982fd891d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Added `Remotes.Forgejo` for specifying a `Remote` hosted on a Forgejo instance (such as codeberg.org). ([#2857]) * Doctests now default to the `parser_for_module` of the module that the docstring appears in, allowing modules that set their syntax version via `Base.Experimental.@set_syntax_version` to have their doctests parsed with the correct syntax automatically. Also added support for `DocTestSyntax` metadata and per-block `syntax=` attributes to explicitly specify a syntax version. ([#2874]) +### Fixed + +* Added error handling for `@example` block result display to avoid crashing when `display_dict` fails. ([#2876]) + ### Changed * reduced time complexity from O(n^2) to O(n) to improve the initial load time for search ([#2875]) diff --git a/src/expander_pipeline.jl b/src/expander_pipeline.jl index aa7656a2fc8..801516331d9 100644 --- a/src/expander_pipeline.jl +++ b/src/expander_pipeline.jl @@ -905,7 +905,12 @@ function Selectors.runner(::Type{Expanders.ExampleBlocks}, node, page, doc) input = droplines(x.code) # Generate different in different formats and let each writer select - output = Base.invokelatest(Documenter.display_dict, result, context = :color => ansicolor) + output = try + Base.invokelatest(Documenter.display_dict, result, context = :color => ansicolor) + catch err + @error "Problem displaying result on page $(page.source): $(err)" + Dict(MIME"text/plain"() => "Error displaying result") + end # Remove references to gensym'd module from text/plain m = MIME"text/plain"() if haskey(output, m)