As the result, the erl_opts was passed to bbmustach:render/3 by relx, which crashed with an error of this type, when trying to render the extended_bin template:
11> bbmustache:render(Bin, Args, [{key_type, atom}]).
** exception error: bad argument
in function iolist_to_binary/1
called as iolist_to_binary([debug_info])
in call from bbmustache:compile_impl/4 (d:/lib/erl-libs/rebar3/_build/default/lib/bbmustache/src/bbmustache.erl, line 233)
in call from bbmustache:compile/3 (d:/lib/erl-libs/rebar3/_build/default/lib/bbmustache/src/bbmustache.erl, line 218)
This error translates in rlx_prv_assermbler simply as {error, render_failed}. It took me a while to figure out the cause of rebar3 failing to build a release.
I'd like to suggest to add a simple argument check to rlx_util:render/2:
render(Template, Data) when is_binary(Template) ->
case [O || O = {K,V} <- Data, not is_atom(K) orelse not io_lib:printable_list(V)] of
[] ->
case catch bbmustache:render(Template, Data,
[{key_type, atom}]) of
Bin when is_binary(Bin) -> {ok, Bin};
_ -> {error, render_failed}
end;
BadArgs ->
{error, {render_bad_args, BadArgs}}
end.
I recently ran into an issue that a rebar3's profile was erroneously defined like this:
As the result, the
erl_opts
was passed to bbmustach:render/3 byrelx
, which crashed with an error of this type, when trying to render theextended_bin
template:This error translates in
rlx_prv_assermbler
simply as{error, render_failed}
. It took me a while to figure out the cause of rebar3 failing to build a release.I'd like to suggest to add a simple argument check to rlx_util:render/2: