Throw exception with error message instead of assert.