Generate better errors when not being able to generate documentation

This commit is contained in:
Paweł Chmielowski 2017-06-19 16:30:45 +02:00
parent 96d385bf82
commit 5424ead01d
1 changed files with 15 additions and 8 deletions

View File

@ -374,14 +374,21 @@ gen_doc(#ejabberd_commands{name=Name, tags=_Tags, desc=Desc, longdesc=LongDesc,
?TAG_R(dd, ResultDesc)])]
end,
[?TAG(h1, [?TAG(strong, atom_to_list(Name)), <<" - ">>, ?RAW(Desc)]),
?TAG(p, ?RAW(LDesc)),
?TAG(h2, <<"Arguments:">>),
ArgsText,
?TAG(h2, <<"Result:">>),
ResultText,
?TAG(h2, <<"Examples:">>),
gen_calls(Cmd, HTMLOutput, Langs)].
try
[?TAG(h1, [?TAG(strong, atom_to_list(Name)), <<" - ">>, ?RAW(Desc)]),
?TAG(p, ?RAW(LDesc)),
?TAG(h2, <<"Arguments:">>),
ArgsText,
?TAG(h2, <<"Result:">>),
ResultText,
?TAG(h2, <<"Examples:">>),
gen_calls(Cmd, HTMLOutput, Langs)]
catch
_:Ex ->
throw(iolist_to_binary(io_lib:format(
<<"Error when generating documentation for command '~p': ~p">>,
[Name, Ex])))
end.
find_commands_definitions() ->
case code:lib_dir(ejabberd, ebin) of