diff options
-rw-r--r-- | build2/function.cxx | 26 | ||||
-rw-r--r-- | build2/function.hxx | 10 |
2 files changed, 19 insertions, 17 deletions
diff --git a/build2/function.cxx b/build2/function.cxx index 44bda57..47d4733 100644 --- a/build2/function.cxx +++ b/build2/function.cxx @@ -238,7 +238,20 @@ namespace build2 } } - return make_pair (f->impl (base, move (args), *f), true); + try + { + return make_pair (f->impl (base, move (args), *f), true); + } + catch (const invalid_argument& e) + { + diag_record dr (fail); + dr << "invalid argument"; + + if (*e.what () != '\0') + dr << ": " << e; + + dr << endf; + } } case 0: { @@ -298,7 +311,6 @@ namespace build2 default_thunk (const scope* base, vector_view<value> args, const function_overload& f) - try { // Call the cast thunk. // @@ -310,16 +322,6 @@ namespace build2 auto d (reinterpret_cast<const cast_data*> (&f.data)); return d->thunk (base, move (args), d); } - catch (const invalid_argument& e) - { - diag_record dr (fail); - dr << "invalid argument"; - - if (*e.what () != '\0') - dr << ": " << e; - - dr << endf; - } #if !defined(_MSC_VER) || _MSC_VER > 1910 constexpr const optional<const value_type*>* function_args<>::types; diff --git a/build2/function.hxx b/build2/function.hxx index 5b84a69..728e613 100644 --- a/build2/function.hxx +++ b/build2/function.hxx @@ -221,12 +221,12 @@ namespace build2 class function_family { public: - // The default thunk catches invalid_argument and issues diagnostics - // by assuming it is related to function arguments and contains useful - // description. + // The call() function above catches invalid_argument and issues + // diagnostics by assuming it is related to function arguments and + // contains useful description. // - // In order to implement a custom thunk (e.g., to catch additional extra - // exceptions), you would normally call the default implementation. + // In order to catch additional exceptions, you can implement a custom + // thunk which would normally call this default implementation. // static value default_thunk (const scope*, vector_view<value>, const function_overload&); |