@cloudant/couchbackup
Advanced tools
Comparing version 2.11.1-SNAPSHOT-264 to 2.11.1-SNAPSHOT-265
@@ -1,2 +0,2 @@ | ||
// Copyright © 2017, 2021 IBM Corp. All rights reserved. | ||
// Copyright © 2017, 2024 IBM Corp. All rights reserved. | ||
// | ||
@@ -40,4 +40,3 @@ // Licensed under the Apache License, Version 2.0 (the "License"); | ||
// Override the status text with an improved message | ||
let errorMsg = `${err.response.status} ${err.response.statusText || ''}: ` + | ||
`${method} ${requestUrl}`; | ||
let errorMsg = `${err.response.status} ${method} ${requestUrl}`; | ||
if (err.response.data) { | ||
@@ -48,19 +47,14 @@ debug('Found response data'); | ||
debug('Response data is JSON'); | ||
// Append the error/reason if available | ||
if (err.response.data.error) { | ||
debug('Augmenting error message with error property'); | ||
// Override the status text with our more complete message | ||
errorMsg += ` - Error: ${err.response.data.error}`; | ||
if (err.response.data.reason) { | ||
debug('Augmenting error message with reason property'); | ||
errorMsg += `, Reason: ${err.response.data.reason}`; | ||
} | ||
// Append the 'errors' message if available | ||
if (err.response.data.errors && err.response.data.errors.length > 0) { | ||
const originalError = err.response.data.errors[0]; | ||
originalError.message = `${errorMsg} - Error: ${originalError.message}`; | ||
} | ||
} else { | ||
errorMsg += err.response.data; | ||
// Set a new message for use by the node-sdk-core | ||
// We use the errors array because it gets processed | ||
// ahead of all other service errors. | ||
err.response.data.errors = [{ message: errorMsg }]; | ||
} | ||
// Set a new message for use by the node-sdk-core | ||
// We use the errors array because it gets processed | ||
// ahead of all other service errors. | ||
err.response.data.errors = [{ message: errorMsg }]; | ||
} | ||
@@ -67,0 +61,0 @@ } else if (err.request) { |
{ | ||
"name": "@cloudant/couchbackup", | ||
"version": "2.11.1-SNAPSHOT-264", | ||
"version": "2.11.1-SNAPSHOT-265", | ||
"description": "CouchBackup - command-line backup utility for Cloudant/CouchDB", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/IBM/couchbackup", |
127984
2433