One of my tests keeps crashing with uncaught exception of type sockpp::sys_error. The exception is expected (the test tries to connect to a nonexistent hostname) but my catch(const std::exception &x) { ... } is being ignored.
I finally realized the problem: sys_error is not compatible with type std::exception because it doesn't publicly inherit from it. Its declaration needs to be changed to
One of my tests keeps crashing with
uncaught exception of type sockpp::sys_error
. The exception is expected (the test tries to connect to a nonexistent hostname) but mycatch(const std::exception &x) { ... }
is being ignored.I finally realized the problem:
sys_error
is not compatible with typestd::exception
because it doesn't publicly inherit from it. Its declaration needs to be changed toi.e. adding
public
after the colon.With this fix, my test works as expected.