handle stream errors when uploading

pull/1/head
ansuz 5 years ago
parent 33623bdafc
commit 744be9929f

@ -74,7 +74,8 @@ var isFile = function (filePath, cb) {
}); });
}; };
var makeFileStream = function (full, cb) { var makeFileStream = function (full, _cb) {
var cb = Util.once(Util.mkAsync(_cb));
Fse.mkdirp(Path.dirname(full), function (e) { Fse.mkdirp(Path.dirname(full), function (e) {
if (e || !full) { // !full for pleasing flow, it's already checked if (e || !full) { // !full for pleasing flow, it's already checked
return void cb(e ? e.message : 'INTERNAL_ERROR'); return void cb(e ? e.message : 'INTERNAL_ERROR');
@ -89,10 +90,8 @@ var makeFileStream = function (full, cb) {
stream.on('open', function () { stream.on('open', function () {
cb(void 0, stream); cb(void 0, stream);
}); });
stream.on('error', function (/* e */) { stream.on('error', function (err) {
//console.error("MAKE_FILE_STREAM", full); cb(err);
// XXX ERROR
//WARN('stream error', e);
}); });
} catch (err) { } catch (err) {
cb('BAD_STREAM'); cb('BAD_STREAM');

Loading…
Cancel
Save