Convert asserts to std::runtime_error where it makes sense
Any calls to the public API with invalid parameters should result in std::runtime_error, not in an assert triggering (which will only happen in debug builds). We will continue using error codes for errors that are not caused by an invalid program (e.g. IO errors), and will use asserts for checking preconditions/postconditions and class invariants.