Error handling: Replaced 'throw "string"' and exit() with proper exceptions.

Using std::runtime_error() for now.