Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions lib/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,12 +425,25 @@ const services = {
const objGetInfo = objectMD.location;
// special case that prevents azure blocks from unecessary deletion
// will return null if no need
return data.protectAzureBlocks(bucketName, objectKey, objGetInfo, log, err => {
if (err) {
return cb(err);
}
return deleteMDandData();
});
// A synchronous throw in the data layer (e.g. no backend client for a location
// that was removed from the overlay) must not escape into the promise machinery:
// it surfaces there as an unhandledRejection and takes the whole process down.
try {
return data.protectAzureBlocks(bucketName, objectKey, objGetInfo, log, err => {
if (err) {
return cb(err);
}
return deleteMDandData();
});
} catch (err) {
log.error('deleteObject: error protecting azure blocks', {
method: 'services.deleteObject',
error: err.message,
bucketName,
objectKey,
});
return cb(errors.InternalError);
}
},

/**
Expand Down
Loading