logs: use %o to format error
otherwise, they are printed as multi-line and this messes up tail+date formatting
This commit is contained in:
@@ -94,7 +94,7 @@ function upload(apiConfig, backupFilePath, sourceStream, callback) {
|
||||
|
||||
function done(error) {
|
||||
if (error) {
|
||||
debug('[%s] upload: gcp upload error.', backupFilePath, error);
|
||||
debug(`upload: [${backupFilePath}] gcp upload error. %o`, error);
|
||||
return callback(new BoxError(BoxError.EXTERNAL_ERROR, `Error uploading ${backupFilePath}. Message: ${error.message} HTTP Code: ${error.code}`));
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ function download(apiConfig, backupFilePath, callback) {
|
||||
if (error && error.code == 404){
|
||||
ps.emit('error', new BoxError(BoxError.NOT_FOUND));
|
||||
} else {
|
||||
debug('[%s] download: gcp stream error.', backupFilePath, error);
|
||||
debug(`download: [${backupFilePath}] gcp stream error. %o`, error);
|
||||
ps.emit('error', new BoxError(BoxError.EXTERNAL_ERROR, error));
|
||||
}
|
||||
})
|
||||
@@ -200,7 +200,7 @@ async function copy(apiConfig, oldFilePath, newFilePath, progressCallback) {
|
||||
var relativePath = path.relative(oldFilePath, entry.fullPath);
|
||||
|
||||
getBucket(apiConfig).file(entry.fullPath).copy(path.join(newFilePath, relativePath), function(error) {
|
||||
if (error) debug('copyBackup: gcs copy error', error);
|
||||
if (error) debug('copyBackup: gcs copy error. %o', error);
|
||||
|
||||
if (error && error.code === 404) return iteratorCallback(new BoxError(BoxError.NOT_FOUND, 'Old backup not found'));
|
||||
if (error) return iteratorCallback(new BoxError(BoxError.EXTERNAL_ERROR, error.message));
|
||||
@@ -278,7 +278,7 @@ async function testConfig(apiConfig) {
|
||||
|
||||
await new Promise((resolve, reject) => {
|
||||
uploadStream.on('error', function(error) {
|
||||
debug('testConfig: failed uploading cloudron-testfile', error);
|
||||
debug('testConfig: failed uploading cloudron-testfile. %o', error);
|
||||
if (error && error.code && (error.code == 403 || error.code == 404)) {
|
||||
return reject(new BoxError(BoxError.BAD_FIELD, error.message));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user