Преглед изворни кода

suppress error when removing nonexistent file from cache

Brian Gough пре 10 година
родитељ
комит
c1cb0f8800
1 измењених фајлова са 5 додато и 1 уклоњено
  1. 5 1
      services/clsi/app/coffee/UrlCache.coffee

+ 5 - 1
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 })