Skip to content

Commit fa7f72a

Browse files
rubenlgpmed
authored andcommitted
Make argument count mismatches easier to debug.
Add context on what was the expected number of arguments as well as the actual count.
1 parent 9d45f2f commit fa7f72a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

v8pp/call_from_v8.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,10 @@ decltype(auto) call_from_v8(F&& func, v8::FunctionCallbackInfo<v8::Value> const&
9393

9494
if (args.Length() != call_traits::arg_count)
9595
{
96-
throw std::runtime_error("argument count does not match function definition");
96+
throw std::runtime_error(
97+
"Argument count does not match function definition. Expected " +
98+
std::to_string(call_traits::arg_count) + " but got " +
99+
std::to_string(args.Length()));
97100
}
98101

99102
if constexpr (with_isolate)

0 commit comments

Comments
 (0)