Throwing exceptions instead of asserts