Skip to content

Commit

Permalink
Merge pull request #419 from scality/fix/replaceUpdate
Browse files Browse the repository at this point in the history
Fix/stopSwallowingErrors
  • Loading branch information
LaurenSpiegel authored Feb 14, 2018
2 parents d0f4f95 + d7cf5e8 commit fd23e82
Showing 1 changed file with 54 additions and 6 deletions.
60 changes: 54 additions & 6 deletions lib/storage/metadata/mongoclient/MongoClientInterface.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,15 @@ class MongoClientInterface {
value: newBucketMD,
}, {
upsert: true,
}, () => cb());
}, err => {
if (err) {
log.error(
'createBucket: error creating bucket',
{ error: err.message });
return cb(errors.InternalError);
}
return cb();
});
}

getBucketAttributes(bucketName, log, cb) {
Expand Down Expand Up @@ -229,7 +237,15 @@ class MongoClientInterface {
value: newBucketMD,
}, {
upsert: true,
}, () => cb());
}, err => {
if (err) {
log.error(
'putBucketAttributes: error putting bucket attributes',
{ error: err.message });
return cb(errors.InternalError);
}
return cb();
});
}

/*
Expand Down Expand Up @@ -312,7 +328,15 @@ class MongoClientInterface {
},
}], {
ordered: 1,
}, () => cb(null, `{"versionId": "${versionId}"}`));
}, err => {
if (err) {
log.error(
'putObjectVerCase1: error putting object version',
{ error: err.message });
return cb(errors.InternalError);
}
return cb(null, `{"versionId": "${versionId}"}`);
});
}

/*
Expand All @@ -332,7 +356,15 @@ class MongoClientInterface {
value: objVal,
}, {
upsert: true,
}, () => cb(null, `{"versionId": "${objVal.versionId}"}`));
}, err => {
if (err) {
log.error(
'putObjectVerCase2: error putting object version',
{ error: err.message });
return cb(errors.InternalError);
}
return cb(null, `{"versionId": "${objVal.versionId}"}`);
});
}

/*
Expand Down Expand Up @@ -368,7 +400,15 @@ class MongoClientInterface {
},
}], {
ordered: 1,
}, () => cb(null, `{"versionId": "${objVal.versionId}"}`));
}, err => {
if (err) {
log.error(
'putObjectVerCase3: error putting object version',
{ error: err.message });
return cb(errors.InternalError);
}
return cb(null, `{"versionId": "${objVal.versionId}"}`);
});
}

/*
Expand Down Expand Up @@ -603,7 +643,15 @@ class MongoClientInterface {
},
}], {
ordered: 1,
}, () => this.deleteOrRepairPHD(c, bucketName, objName, mst, log, cb));
}, err => {
if (err) {
log.error(
'deleteObjectVerMaster: error deleting object',
{ error: err.message });
return cb(errors.InternalError);
}
return this.deleteOrRepairPHD(c, bucketName, objName, mst, log, cb);
});
}

/*
Expand Down

0 comments on commit fd23e82

Please sign in to comment.