Skip to content

Commit 29f4d4f

Browse files
committed
fix(Handlebars): helper calls report errors
1 parent b3ac35d commit 29f4d4f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/lib/Support/Handlebars.cpp

+11-1
Original file line numberDiff line numberDiff line change
@@ -2583,7 +2583,17 @@ renderExpression(
25832583
HandlebarsOptions noStrict = opt;
25842584
noStrict.strict = false;
25852585
setupArgs(tag.arguments, context, state, args, cb, noStrict);
2586-
auto v2 = resV.value.getFunction().call(args).value();
2586+
Expected<dom::Value> expV2 = resV.value.getFunction().call(args);
2587+
if (!expV2) {
2588+
Error e = expV2.error();
2589+
auto res = find_position_in_text(state.rootTemplateText, helper_expr);
2590+
std::string const& msg = e.reason();
2591+
if (res) {
2592+
return Unexpected(HandlebarsError(msg, res.line, res.column, res.pos));
2593+
}
2594+
return Unexpected(HandlebarsError(msg));
2595+
}
2596+
dom::Value v2 = *std::move(expV2);
25872597
format_to(out, v2, opt2);
25882598
}
25892599
else

0 commit comments

Comments
 (0)