fix error handling for selecting invalid file type

(The error was never appearing because the test was missing quotation
marks.)