Errors of polymorphic types (such as std::runtime_error) should be caught by reference to prevent object slicing (especially since what() is virtual). I'm not sure whether there's any possibility of subclasses of, say, std::runtime_error being thrown, but it doesn't hurt to catch by reference and at the very least this change silences some warnings.
Errors of polymorphic types (such as
std::runtime_error
) should be caught by reference to prevent object slicing (especially sincewhat()
is virtual). I'm not sure whether there's any possibility of subclasses of, say,std::runtime_error
being thrown, but it doesn't hurt to catch by reference and at the very least this change silences some warnings.