Throw a correct error if the file has no extension