|
@@ -235,11 +235,17 @@ parse_spec_ref(Module, Path, Options) ->
|
|
|
Schema =
|
|
Schema =
|
|
|
try
|
|
try
|
|
|
erlang:apply(Module, schema, [Path])
|
|
erlang:apply(Module, schema, [Path])
|
|
|
- %% better error message
|
|
|
|
|
catch
|
|
catch
|
|
|
- error:Reason:Stacktrace ->
|
|
|
|
|
- MoreInfo = #{module => Module, path => Path, reason => Reason},
|
|
|
|
|
- erlang:raise(error, MoreInfo, Stacktrace)
|
|
|
|
|
|
|
+ Error:Reason:Stacktrace ->
|
|
|
|
|
+ %% This error is intended to fail the build
|
|
|
|
|
+ %% hence print to standard_error
|
|
|
|
|
+ io:format(
|
|
|
|
|
+ standard_error,
|
|
|
|
|
+ "Failed to generate swagger for path ~p in module ~p~n"
|
|
|
|
|
+ "error:~p~nreason:~p~n~p~n",
|
|
|
|
|
+ [Module, Path, Error, Reason, Stacktrace]
|
|
|
|
|
+ ),
|
|
|
|
|
+ error({failed_to_generate_swagger_spec, Module, Path})
|
|
|
end,
|
|
end,
|
|
|
{Specs, Refs} = maps:fold(
|
|
{Specs, Refs} = maps:fold(
|
|
|
fun(Method, Meta, {Acc, RefsAcc}) ->
|
|
fun(Method, Meta, {Acc, RefsAcc}) ->
|