Capture writer error

This commit is contained in:
Raymond Feng 2015-07-31 12:05:55 -07:00
parent 52638e65f5
commit e8c76eef93
2 changed files with 3 additions and 3 deletions

View File

@ -10,7 +10,7 @@
"errorhandler": "^1.1.1", "errorhandler": "^1.1.1",
"loopback": "^2.0.0", "loopback": "^2.0.0",
"loopback-boot": "^2.0.0", "loopback-boot": "^2.0.0",
"loopback-component-storage": "~1.0.5", "loopback-component-storage": "^1.5.0",
"loopback-datasource-juggler": "^2.7.0", "loopback-datasource-juggler": "^2.7.0",
"serve-favicon": "^2.0.1" "serve-favicon": "^2.0.1"
}, },

View File

@ -115,7 +115,7 @@ exports.upload = function (provider, req, res, options, cb) {
var writer = provider.upload(uploadParams); var writer = provider.upload(uploadParams);
writer.on('error', function(err) { writer.on('error', function(err) {
self._error(err); self.emit('error', err);
}); });
var endFunc = function () { var endFunc = function () {
@ -150,10 +150,10 @@ exports.upload = function (provider, req, res, options, cb) {
}); });
} }
part.pipe(writer, { end: false });
part.on("end", function () { part.on("end", function () {
writer.end(); writer.end();
}); });
part.pipe(writer, { end: false });
}; };
form.parse(req, function (err, _fields, _files) { form.parse(req, function (err, _fields, _files) {