Throw an exception instead of logging an error