Throw exceptions if fileNmae is not a string.