pothosware / PothosCore

The Pothos data-flow framework
https://github.com/pothosware/PothosCore/wiki
Boost Software License 1.0
302 stars 48 forks source link

Added exception class to map arbitrary error codes to C++ exceptions #202

Closed ncorgan closed 4 years ago

guruofquality commented 4 years ago

Is it possible to actually throw the exception with a template, rather than creating a templated function to throw it?

Like this:

template <typename BaseException>
class ExceptionForErrorCode : public BaseException
{
public:
    ExceptionForErrorCode(int errorCode, const std::error_category& category);
}

and thrown like that:

throw ExceptionForErrorCode<SystemException>(EINVAL, category);

i think its more syntactically like c++'s intention for exception and it doesnt add to the callstack. But I dont know if I just made up something impossible.

ncorgan commented 4 years ago

Rebased off of master and refactored as described