Improved error handling for unrecognised file extensions.