diff options
| author | Jules <jules@asdf.us> | 2018-01-11 08:18:27 -0500 |
|---|---|---|
| committer | Jules <jules@asdf.us> | 2018-01-11 08:18:27 -0500 |
| commit | bf3f6e6cc62ec1f651ba093c7763a9e59eec48b3 (patch) | |
| tree | 819109fc36c46d990614949325a48ef5c445eabb /bucky | |
| parent | b3ba48a22ce966e62cfad1671e4ee6f4357bb69f (diff) | |
logging
Diffstat (limited to 'bucky')
| -rw-r--r-- | bucky/db/index.js | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/bucky/db/index.js b/bucky/db/index.js index 350f2a4..935219f 100644 --- a/bucky/db/index.js +++ b/bucky/db/index.js @@ -156,16 +156,20 @@ db.moveFile = function(file, thread_id){ var s3client = upload.client() var srcPath = '/bucky/data/' + file.get('thread') + '/' + file.get('filename') var destPath = '/bucky/data/' + thread_id + '/' + file.get('filename') + console.log('moving', srcPath, 'to', destPath) var copyPromise = new Promise((resolve, reject) => { s3client.copy(srcPath, destPath).on('response', function(res){ + console.log('copied file') s3client.deleteFile(srcPath, function(err, res){ if (err) { + console.log('error deleting file') return reject(err) } file.set('thread', thread_id) file.save().then(() => { resolve() }).catch(err => { + console.log('error saving file') reject(err) }) }) |
