diff --git a/base/docs/Docs.jl b/base/docs/Docs.jl index 171ea5aa7e326..7b59b3c9a8510 100644 --- a/base/docs/Docs.jl +++ b/base/docs/Docs.jl @@ -439,6 +439,12 @@ __doc__!(meta, def) = false fexpr(ex) = isexpr(ex, :function, :stagedfunction, :(=)) && isexpr(ex.args[1], :call) function docm(meta, def, define = true) + + err = ( + "Invalid doc expression:", def, isexpr(def, :macrocall) ? + "'$(def.args[1])' is not documentable. See 'help?> Docs.@__doc__' for details." : "" + ) + def′ = unblock(def) isexpr(def′, :quote) && isexpr(def′.args[1], :macrocall) && @@ -463,7 +469,7 @@ function docm(meta, def, define = true) isvar(def′) ? objdoc(meta, def′) : isexpr(def′, :tuple) ? multidoc(meta, def′.args) : __doc__!(meta, def′) ? esc(def′) : - isa(def′, Expr) ? error("Invalid doc expression $def′") : + isa(def′, Expr) ? error(strip(join(err, "\n\n"))) : objdoc(meta, def′) end