mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
log errors in detail when file cannot be removed
This commit is contained in:
parent
0ca584cb55
commit
4a785ff43c
1 changed files with 12 additions and 3 deletions
|
@ -54,9 +54,18 @@ module.exports = ResourceWriter =
|
|||
|
||||
_deleteFileIfNotDirectory: (path, callback = (error) ->) ->
|
||||
fs.stat path, (error, stat) ->
|
||||
return callback(error) if error?
|
||||
if stat.isFile()
|
||||
fs.unlink path, callback
|
||||
if error? and error.code is 'ENOENT'
|
||||
return callback()
|
||||
else if error?
|
||||
logger.err {err: error, path: path}, "error stating file in deleteFileIfNotDirectory"
|
||||
return callback(error)
|
||||
else if stat.isFile()
|
||||
fs.unlink path, (error) ->
|
||||
if error?
|
||||
logger.err {err: error, path: path}, "error removing file in deleteFileIfNotDirectory"
|
||||
callback(error)
|
||||
else
|
||||
callback()
|
||||
else
|
||||
callback()
|
||||
|
||||
|
|
Loading…
Reference in a new issue