Skip to content

Commit 94e015d

Browse files
authored
Merge pull request #833 from ahoka/callback
Fix callback validation
2 parents 2ed2a08 + b557446 commit 94e015d

4 files changed

Lines changed: 7 additions & 4 deletions

File tree

lib/web/imageRouter/filesystem.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
const url = require('url')
33

44
const config = require('../../config')
5+
const logger = require('../../logger')
56

67
exports.uploadImage = function (imagePath, callback) {
78
if (!imagePath || typeof imagePath !== 'string') {
@@ -10,7 +11,7 @@ exports.uploadImage = function (imagePath, callback) {
1011
}
1112

1213
if (!callback || typeof callback !== 'function') {
13-
callback(new Error('Callback has to be a function'), null)
14+
logger.error('Callback has to be a function')
1415
return
1516
}
1617

lib/web/imageRouter/imgur.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ exports.uploadImage = function (imagePath, callback) {
1111
}
1212

1313
if (!callback || typeof callback !== 'function') {
14-
callback(new Error('Callback has to be a function'), null)
14+
logger.error('Callback has to be a function')
1515
return
1616
}
1717

lib/web/imageRouter/minio.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const path = require('path')
44

55
const config = require('../../config')
66
const {getImageMimeType} = require('../../utils')
7+
const logger = require('../../logger')
78

89
const Minio = require('minio')
910
const minioClient = new Minio.Client({
@@ -21,7 +22,7 @@ exports.uploadImage = function (imagePath, callback) {
2122
}
2223

2324
if (!callback || typeof callback !== 'function') {
24-
callback(new Error('Callback has to be a function'), null)
25+
logger.error('Callback has to be a function')
2526
return
2627
}
2728

lib/web/imageRouter/s3.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const path = require('path')
44

55
const config = require('../../config')
66
const {getImageMimeType} = require('../../utils')
7+
const logger = require('../../logger')
78

89
const AWS = require('aws-sdk')
910
const awsConfig = new AWS.Config(config.s3)
@@ -16,7 +17,7 @@ exports.uploadImage = function (imagePath, callback) {
1617
}
1718

1819
if (!callback || typeof callback !== 'function') {
19-
callback(new Error('Callback has to be a function'), null)
20+
logger.error('Callback has to be a function')
2021
return
2122
}
2223

0 commit comments

Comments
 (0)