Trending images #77
1 changed files with 4 additions and 4 deletions
|
@ -27,7 +27,7 @@ module.exports = (app, siofu, hostedContentPath) => {
|
||||||
// listener for when file upload encounters an error
|
// listener for when file upload encounters an error
|
||||||
uploader.on('error', ({ error }) => {
|
uploader.on('error', ({ error }) => {
|
||||||
logger.error('an error occured while uploading', error);
|
logger.error('an error occured while uploading', error);
|
||||||
postToStats('publish', '/', null, null, null, null, error);
|
postToStats('publish', '/', null, null, null, null, null, error);
|
||||||
socket.emit('publish-status', error);
|
socket.emit('publish-status', error);
|
||||||
});
|
});
|
||||||
// listener for when file has been uploaded
|
// listener for when file has been uploaded
|
||||||
|
@ -41,18 +41,18 @@ module.exports = (app, siofu, hostedContentPath) => {
|
||||||
publishController
|
publishController
|
||||||
.publish(publishParams, file.name, file.meta.type)
|
.publish(publishParams, file.name, file.meta.type)
|
||||||
.then(result => {
|
.then(result => {
|
||||||
postToStats('publish', '/', null, null, null, null, 'success');
|
postToStats('publish', '/', null, null, null, null, null, 'success');
|
||||||
socket.emit('publish-complete', { name: publishParams.name, result });
|
socket.emit('publish-complete', { name: publishParams.name, result });
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
error = errorHandlers.handlePublishError(error);
|
error = errorHandlers.handlePublishError(error);
|
||||||
postToStats('publish', '/', null, null, null, null, error);
|
postToStats('publish', '/', null, null, null, null, null, error);
|
||||||
socket.emit('publish-failure', error);
|
socket.emit('publish-failure', error);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
logger.error(`An error occurred in uploading the client's file`);
|
logger.error(`An error occurred in uploading the client's file`);
|
||||||
socket.emit('publish-failure', 'File uploaded, but with errors');
|
socket.emit('publish-failure', 'File uploaded, but with errors');
|
||||||
postToStats('publish', '/', null, null, null, null, 'File uploaded, but with errors');
|
postToStats('publish', '/', null, null, null, null, null, 'File uploaded, but with errors');
|
||||||
// to-do: remove the file if not done automatically
|
// to-do: remove the file if not done automatically
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue