Fix use-after-free errors in exceptions
Fix use-after-free errors in exceptions

Done by avoiding directly from std::exception but either one of
logic_error or runtume_error (or their subclasses); both already
implement message reporting.
Cf. issue #462

stoewer/nix