Throw exception instead of logging in debug mode.