Improve error handling in the 'getFileTempDirectory' procedure.