[C++-sig] Re: argument_error

David Abrahams dave at boost-consulting.com
Tue Aug 19 03:11:48 CEST 2003


Nikolay Mladenov <nickm at sitius.com> writes:

> Hi,
>
> In occasion I do argument validation, like checking if sequence elements
> are all of some type(s),
> and with  1_29_0 I was throwing python::argument_error if the validation
> fails.

That was never the right thing to do since Boost.Python v1.

> In the CVS argument_error is not in the headers. What would be the
> proper way of doing this now?

Do you just want to report an error or do you want overload resolution
to continue to search for a match?  If you just want to report an
error, you can throw any C++ exception you like, or raise a Python
TypeError:

    PyErr_SetString(PyExc_TypeError, "blah blah");
    python::throw_error_already_set();

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com





More information about the Cplusplus-sig mailing list