Skip to content

Commit

Permalink
Merge branch 'bugfix/CLDSRV-571-better-handling-of-errors' into tmp/o…
Browse files Browse the repository at this point in the history
…ctopus/w/8.8/bugfix/CLDSRV-571-better-handling-of-errors
  • Loading branch information
bert-e committed Dec 2, 2024
2 parents 610dc83 + d9d4324 commit a592eec
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/api/apiUtils/bucket/bucketDeletion.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function deleteBucket(authInfo, bucketMD, bucketName, canonicalID, request, log,
log, (err, objectsListRes) => {
// If no shadow bucket ever created, no ongoing MPU's, so
// continue with deletion
if (err?.is.NoSuchBucket) {
if (err?.is?.NoSuchBucket) {
return next();
}
if (err) {
Expand Down
2 changes: 1 addition & 1 deletion lib/api/multiObjectDelete.js
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ function multiObjectDelete(authInfo, request, log, callback) {
return vault.checkPolicies(requestContextParams, authInfo.getArn(),
log, (err, authorizationResults) => {
// there were no policies so received a blanket AccessDenied
if (err?.is.AccessDenied) {
if (err?.is?.AccessDenied) {
objects.forEach(entry => {
errorResults.push({
entry,
Expand Down
4 changes: 2 additions & 2 deletions lib/api/multipartDelete.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ function multipartDelete(authInfo, request, log, callback) {
request.method, destinationBucket);
const location = destinationBucket ?
destinationBucket.getLocationConstraint() : null;
if (err && !err.is.NoSuchUpload) {
if (err && !err?.is?.NoSuchUpload) {
return callback(err, corsHeaders);
}
if (err?.is.NoSuchUpload && isLegacyAWSBehavior(location)) {
if (err?.is?.NoSuchUpload && isLegacyAWSBehavior(location)) {
log.trace('did not find valid mpu with uploadId', {
method: 'multipartDelete',
uploadId,
Expand Down
4 changes: 2 additions & 2 deletions lib/api/objectPutPart.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ function objectPutPart(authInfo, request, streamingV4Params, log,
// Get the destination bucket.
next => metadata.getBucket(bucketName, log,
(err, destinationBucket) => {
if (err?.is.NoSuchBucket) {
if (err?.is?.NoSuchBucket) {
return next(errors.NoSuchBucket, destinationBucket);
}
if (err) {
Expand Down Expand Up @@ -163,7 +163,7 @@ function objectPutPart(authInfo, request, streamingV4Params, log,
(destinationBucket, cipherBundle, next) =>
metadata.getBucket(mpuBucketName, log,
(err, mpuBucket) => {
if (err?.is.NoSuchBucket) {
if (err?.is?.NoSuchBucket) {
return next(errors.NoSuchUpload, destinationBucket);
}
if (err) {
Expand Down
2 changes: 1 addition & 1 deletion lib/routes/routeBackbeat.js
Original file line number Diff line number Diff line change
Expand Up @@ -1157,7 +1157,7 @@ function batchDelete(request, response, userInfo, log, callback) {
_loc.deleteVersion = true;
}
dataWrapper.data.delete(_loc, log, err => {
if (err?.is.ObjNotFound) {
if (err?.is?.ObjNotFound) {
log.info('batch delete: data location do not exist', {
method: 'batchDelete',
location: loc,
Expand Down
6 changes: 3 additions & 3 deletions lib/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const services = {
// buckets to list. By returning an empty array, the
// getService API will just respond with the user info
// without listing any buckets.
if (err?.is.NoSuchBucket) {
if (err?.is?.NoSuchBucket) {
log.trace('no buckets found');
// If we checked the old user bucket, that means we
// already checked the new user bucket. If neither the
Expand Down Expand Up @@ -647,7 +647,7 @@ const services = {
// If the MPU was initiated, the mpu bucket should exist.
const mpuBucketName = `${constants.mpuBucketPrefix}${bucketName}`;
metadata.getBucket(mpuBucketName, log, (err, mpuBucket) => {
if (err?.is.NoSuchBucket) {
if (err?.is?.NoSuchBucket) {
log.debug('bucket not found in metadata', { error: err,
method: 'services.metadataValidateMultipart' });
return cb(errors.NoSuchUpload);
Expand Down Expand Up @@ -851,7 +851,7 @@ const services = {
assert.strictEqual(typeof bucketName, 'string');
const MPUBucketName = `${constants.mpuBucketPrefix}${bucketName}`;
metadata.getBucket(MPUBucketName, log, (err, bucket) => {
if (err?.is.NoSuchBucket) {
if (err?.is?.NoSuchBucket) {
log.trace('no buckets found');
const creationDate = new Date().toJSON();
const mpuBucket = new BucketInfo(MPUBucketName,
Expand Down

0 comments on commit a592eec

Please sign in to comment.