use C++ exception handling (because we can)

Untested.