Provide a better error message if a filename is not valid.