|
|
@@ -111,13 +111,21 @@ module.exports = function(primary, fallback) {
|
|
|
|
|
|
await primary.promises.sendStream(destBucket, destKey, stream, sourceMd5)
|
|
|
} catch (err) {
|
|
|
- let error = err
|
|
|
+ const error = new WriteError({
|
|
|
+ message: 'unable to copy file to destination persistor',
|
|
|
+ info: {
|
|
|
+ sourceBucket,
|
|
|
+ destBucket,
|
|
|
+ sourceKey,
|
|
|
+ destKey
|
|
|
+ }
|
|
|
+ }).withCause(err)
|
|
|
metrics.inc('fallback.copy.failure')
|
|
|
|
|
|
try {
|
|
|
await primary.promises.deleteFile(destBucket, destKey)
|
|
|
} catch (err) {
|
|
|
- error = new WriteError({
|
|
|
+ error.info.cleanupError = new WriteError({
|
|
|
message: 'unable to clean up destination copy artifact',
|
|
|
info: {
|
|
|
destBucket,
|
|
|
@@ -126,16 +134,6 @@ module.exports = function(primary, fallback) {
|
|
|
}).withCause(err)
|
|
|
}
|
|
|
|
|
|
- error = new WriteError({
|
|
|
- message: 'unable to copy file to destination persistor',
|
|
|
- info: {
|
|
|
- sourceBucket,
|
|
|
- destBucket,
|
|
|
- sourceKey,
|
|
|
- destKey
|
|
|
- }
|
|
|
- }).withCause(error)
|
|
|
-
|
|
|
logger.warn({ error }, 'failed to copy file from fallback')
|
|
|
throw error
|
|
|
}
|