Throw exception for better error reporting