From c1cb0f8800b95c0cf050beaa5a2a1cef3b3f4dad Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Thu, 31 Mar 2016 13:33:42 +0100 Subject: [PATCH] suppress error when removing nonexistent file from cache --- services/clsi/app/coffee/UrlCache.coffee | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/services/clsi/app/coffee/UrlCache.coffee b/services/clsi/app/coffee/UrlCache.coffee index 535a70570c..b72b78ca0f 100644 --- a/services/clsi/app/coffee/UrlCache.coffee +++ b/services/clsi/app/coffee/UrlCache.coffee @@ -87,7 +87,11 @@ module.exports = UrlCache = callback null _deleteUrlCacheFromDisk: (project_id, url, callback = (error) ->) -> - fs.unlink UrlCache._cacheFilePathForUrl(project_id, url), callback + fs.unlink UrlCache._cacheFilePathForUrl(project_id, url), (error) -> + if error? and error.code != 'ENOENT' # no error if the file isn't present + return callback(error) + else + return callback() _findUrlDetails: (project_id, url, callback = (error, urlDetails) ->) -> db.UrlCache.find(where: { url: url, project_id: project_id })