Use Boost.Exception.