mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-16 21:56:25 -05:00
chore: tweak error logging messages (#4966)
* chore: tweak error logging messages * Update tricky-impalas-shake.md
This commit is contained in:
parent
47e6ce9083
commit
3967a5280a
3 changed files with 43 additions and 43 deletions
6
.changeset/tricky-impalas-shake.md
Normal file
6
.changeset/tricky-impalas-shake.md
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
'@verdaccio/local-storage': patch
|
||||||
|
'@verdaccio/store': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
chore: tweak error logging messages
|
|
@ -107,7 +107,7 @@ export default class LocalFS implements ILocalFSPackageManager {
|
||||||
// we ensure lock the file
|
// we ensure lock the file
|
||||||
this.logger.error(
|
this.logger.error(
|
||||||
{ err, packageName },
|
{ err, packageName },
|
||||||
'error @{err.message} on update package @{packageName}'
|
'error on update package @{packageName}: @{err.message}'
|
||||||
);
|
);
|
||||||
if (locked) {
|
if (locked) {
|
||||||
// eslint-disable-next-line no-useless-catch
|
// eslint-disable-next-line no-useless-catch
|
||||||
|
@ -158,7 +158,7 @@ export default class LocalFS implements ILocalFSPackageManager {
|
||||||
debug('dir: %o does not exist %s', pathName, err?.code);
|
debug('dir: %o does not exist %s', pathName, err?.code);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
this.logger.error('error on verify a package exist %o', err);
|
this.logger.error({ err }, 'error on verify a package exist: @{err.message}');
|
||||||
throw errorUtils.getInternalError('error on verify a package exist');
|
throw errorUtils.getInternalError('error on verify a package exist');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -204,7 +204,7 @@ export default class LocalFS implements ILocalFSPackageManager {
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
if (err.code !== noSuchFile) {
|
if (err.code !== noSuchFile) {
|
||||||
debug('parse error');
|
debug('parse error');
|
||||||
this.logger.error({ err, name }, 'error @{err.message} on parse @{name}');
|
this.logger.error({ err, name }, 'error on parse @{name}: @{err.message}');
|
||||||
}
|
}
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
@ -255,8 +255,8 @@ export default class LocalFS implements ILocalFSPackageManager {
|
||||||
writeStream.on('error', async (err) => {
|
writeStream.on('error', async (err) => {
|
||||||
if (opened) {
|
if (opened) {
|
||||||
this.logger.error(
|
this.logger.error(
|
||||||
{ err: err.message, fileName },
|
{ err, fileName },
|
||||||
'error on open write tarball for @{pkgName}'
|
'error on open write tarball for @{fileName}: @{err.message}'
|
||||||
);
|
);
|
||||||
// TODO: maybe add .once
|
// TODO: maybe add .once
|
||||||
writeStream.on('close', async () => {
|
writeStream.on('close', async () => {
|
||||||
|
@ -264,8 +264,8 @@ export default class LocalFS implements ILocalFSPackageManager {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.logger.error(
|
this.logger.error(
|
||||||
{ err: err.message, fileName },
|
{ err, fileName },
|
||||||
'error a non open write tarball for @{pkgName}'
|
'error on writing tarball for @{fileName}: @{err.message}'
|
||||||
);
|
);
|
||||||
await this.removeTempFile(temporalName);
|
await this.removeTempFile(temporalName);
|
||||||
}
|
}
|
||||||
|
@ -279,8 +279,9 @@ export default class LocalFS implements ILocalFSPackageManager {
|
||||||
await renameTmp(temporalName, pathName);
|
await renameTmp(temporalName, pathName);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.logger.error(
|
this.logger.error(
|
||||||
{ err },
|
{ err, temporalName, pathName },
|
||||||
'error on rename temporal file, please report this is a bug @{err}'
|
'error on rename temporal file @{temporalName} to @{pathName}: @{err.message},' +
|
||||||
|
'please report this bug'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -377,7 +378,7 @@ export default class LocalFS implements ILocalFSPackageManager {
|
||||||
await this.writeTempFileAndRename(destiny, fileContent);
|
await this.writeTempFileAndRename(destiny, fileContent);
|
||||||
debug('write file success %s', destiny);
|
debug('write file success %s', destiny);
|
||||||
} else {
|
} else {
|
||||||
this.logger.error({ err: err.message }, 'error on write file @{err}');
|
this.logger.error({ err }, 'error on write file: @{err.message}');
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -410,7 +411,7 @@ export default class LocalFS implements ILocalFSPackageManager {
|
||||||
});
|
});
|
||||||
return data;
|
return data;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.logger.error({ err }, 'error on lock file @{err.message}');
|
this.logger.error({ err }, 'error on lock file: @{err.message}');
|
||||||
debug('error on lock and read json for file: %o', name);
|
debug('error on lock and read json for file: %o', name);
|
||||||
|
|
||||||
throw err;
|
throw err;
|
||||||
|
|
|
@ -233,7 +233,7 @@ class Storage {
|
||||||
await storage.deletePackage(filename);
|
await storage.deletePackage(filename);
|
||||||
debug('package %s removed', filename);
|
debug('package %s removed', filename);
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
this.logger.error({ err }, 'error removing %s from storage');
|
this.logger.error({ err }, 'error removing from storage: @{err.message}');
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
return manifest;
|
return manifest;
|
||||||
|
@ -438,7 +438,7 @@ class Storage {
|
||||||
localTarballStream.emit('error', err);
|
localTarballStream.emit('error', err);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.logger.error({ err: err.message }, 'some error on fatal @{err}');
|
this.logger.error({ err }, 'some error on fatal: @{err.message}');
|
||||||
localTarballStream.emit('error', err);
|
localTarballStream.emit('error', err);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -506,9 +506,9 @@ class Storage {
|
||||||
if (options.byPassCache === true) {
|
if (options.byPassCache === true) {
|
||||||
try {
|
try {
|
||||||
await this.checkAllowedToChangePackage(manifest, options.requestOptions.username);
|
await this.checkAllowedToChangePackage(manifest, options.requestOptions.username);
|
||||||
} catch (error: any) {
|
} catch (err: any) {
|
||||||
this.logger.error({ error: error.message }, 'getting package has failed: @{error}');
|
this.logger.error({ err }, 'getting package has failed: @{err.message}');
|
||||||
throw errorUtils.getBadRequest(error.message);
|
throw errorUtils.getBadRequest(err.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -759,7 +759,10 @@ class Storage {
|
||||||
}
|
}
|
||||||
debug('search local stream end');
|
debug('search local stream end');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.logger.error({ err, query }, 'error on search by plugin @{err.message}');
|
this.logger.error(
|
||||||
|
{ err, query },
|
||||||
|
'error on search by plugin for @{query.text}: @{err.message}'
|
||||||
|
);
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -786,8 +789,8 @@ class Storage {
|
||||||
throw errorUtils.getNotFound();
|
throw errorUtils.getNotFound();
|
||||||
}
|
}
|
||||||
this.logger.error(
|
this.logger.error(
|
||||||
{ pkgName, revision, err: err.message },
|
{ pkgName, revision, err },
|
||||||
'error @{err} while reading package @{pkgName}-{revision}'
|
'error while reading package @{pkgName}-{revision}: @{err.message}'
|
||||||
);
|
);
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
@ -814,7 +817,7 @@ class Storage {
|
||||||
await storage.removePackage();
|
await storage.removePackage();
|
||||||
this.logger.info({ pkgName }, 'package @{pkgName} removed');
|
this.logger.info({ pkgName }, 'package @{pkgName} removed');
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
this.logger.error({ err }, 'removed package has failed @{err.message}');
|
this.logger.error({ err }, 'removed package has failed: @{err.message}');
|
||||||
throw errorUtils.getBadData(err.message);
|
throw errorUtils.getBadData(err.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -844,8 +847,8 @@ class Storage {
|
||||||
throw errorUtils.getNotFound();
|
throw errorUtils.getNotFound();
|
||||||
}
|
}
|
||||||
this.logger.error(
|
this.logger.error(
|
||||||
{ err: err, file: STORAGE.PACKAGE_FILE_NAME },
|
{ err, file: STORAGE.PACKAGE_FILE_NAME },
|
||||||
`error reading @{file}: @{!err.message}`
|
'error reading @{file}: @{err.message}'
|
||||||
);
|
);
|
||||||
|
|
||||||
throw errorUtils.getInternalError();
|
throw errorUtils.getInternalError();
|
||||||
|
@ -963,8 +966,8 @@ class Storage {
|
||||||
const { name } = mergedManifest;
|
const { name } = mergedManifest;
|
||||||
await this.notify(mergedManifest, `${name}@${version}`);
|
await this.notify(mergedManifest, `${name}@${version}`);
|
||||||
this.logger.info({ name, version }, 'notify for @{name}@@{version} has been sent');
|
this.logger.info({ name, version }, 'notify for @{name}@@{version} has been sent');
|
||||||
} catch (error: any) {
|
} catch (err: any) {
|
||||||
this.logger.error({ error: error.message }, 'notify batch service has failed: @{error}');
|
this.logger.error({ err }, 'notify batch service has failed: @{err.message}');
|
||||||
}
|
}
|
||||||
return message;
|
return message;
|
||||||
} else if (validatioUtils.validateUnPublishSingleVersion(manifest)) {
|
} else if (validatioUtils.validateUnPublishSingleVersion(manifest)) {
|
||||||
|
@ -1187,7 +1190,7 @@ class Storage {
|
||||||
}
|
}
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
debug('error on change or update a package with %o', err.message);
|
debug('error on change or update a package with %o', err.message);
|
||||||
this.logger.error({ err: err.message }, 'error on publish new version: @{err}');
|
this.logger.error({ err }, 'error on publish new version: @{err.message}');
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1202,7 +1205,7 @@ class Storage {
|
||||||
// addVersion will move the readme from the the published version to the root level
|
// addVersion will move the readme from the the published version to the root level
|
||||||
await this.addVersion(name, versionToPublish, versions[versionToPublish], null, tarballStats);
|
await this.addVersion(name, versionToPublish, versions[versionToPublish], null, tarballStats);
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
this.logger.error({ err: err.message }, 'updated version has failed: @{err}');
|
this.logger.error({ err }, 'updated version has failed: @{err.message}');
|
||||||
debug('error on create a version for %o with error %o', name, err.message);
|
debug('error on create a version for %o with error %o', name, err.message);
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
@ -1217,7 +1220,7 @@ class Storage {
|
||||||
// 4. update once to the storage (easy peasy)
|
// 4. update once to the storage (easy peasy)
|
||||||
mergedManifest = await this.mergeTagsNext(name, manifest[DIST_TAGS]);
|
mergedManifest = await this.mergeTagsNext(name, manifest[DIST_TAGS]);
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
this.logger.error({ err: err.message }, 'merge version has failed: @{err}');
|
this.logger.error({ err }, 'merge version has failed: @{err.message}');
|
||||||
debug('error on create a version for %o with error %o', name, err.message);
|
debug('error on create a version for %o with error %o', name, err.message);
|
||||||
// TODO: undo if this fails
|
// TODO: undo if this fails
|
||||||
// 1. remove updated version
|
// 1. remove updated version
|
||||||
|
@ -1231,7 +1234,7 @@ class Storage {
|
||||||
signal: options.signal,
|
signal: options.signal,
|
||||||
});
|
});
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
this.logger.error({ err: err.message }, 'upload tarball has failed: @{err}');
|
this.logger.error({ err }, 'upload tarball has failed: @{err.message}');
|
||||||
// TODO: undo if this fails
|
// TODO: undo if this fails
|
||||||
// 1. remove updated version
|
// 1. remove updated version
|
||||||
// 2. remove new dist tags
|
// 2. remove new dist tags
|
||||||
|
@ -1831,12 +1834,7 @@ class Storage {
|
||||||
try {
|
try {
|
||||||
_cacheManifest = validatioUtils.normalizeMetadata(_cacheManifest, _cacheManifest.name);
|
_cacheManifest = validatioUtils.normalizeMetadata(_cacheManifest, _cacheManifest.name);
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
this.logger.error(
|
this.logger.error({ err }, 'package.json validating error @{!err?.message}\n@{err.stack}');
|
||||||
{
|
|
||||||
err: err,
|
|
||||||
},
|
|
||||||
'package.json validating error @{!err?.message}\n@{err.stack}'
|
|
||||||
);
|
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
// updates the _uplink metadata fields, cache, etc
|
// updates the _uplink metadata fields, cache, etc
|
||||||
|
@ -1850,12 +1848,7 @@ class Storage {
|
||||||
_cacheManifest = mergeVersions(_cacheManifest, remoteManifest);
|
_cacheManifest = mergeVersions(_cacheManifest, remoteManifest);
|
||||||
return _cacheManifest;
|
return _cacheManifest;
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
this.logger.error(
|
this.logger.error({ err }, 'package.json merge has failed @{!err?.message}\n@{err.stack}');
|
||||||
{
|
|
||||||
err: err,
|
|
||||||
},
|
|
||||||
'package.json merge has failed @{!err?.message}\n@{err.stack}'
|
|
||||||
);
|
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1879,7 +1872,7 @@ class Storage {
|
||||||
try {
|
try {
|
||||||
filteredManifest = await filter.filter_metadata(manifest);
|
filteredManifest = await filter.filter_metadata(manifest);
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
this.logger.error({ err: err.message }, 'filter has failed @{err}');
|
this.logger.error({ err }, 'filter has failed: @{err.message}');
|
||||||
filterPluginErrors.push(err);
|
filterPluginErrors.push(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1935,8 +1928,8 @@ class Storage {
|
||||||
return this._createNewPackage(pkgName);
|
return this._createNewPackage(pkgName);
|
||||||
} else {
|
} else {
|
||||||
this.logger.error(
|
this.logger.error(
|
||||||
{ err: err, file: STORAGE.PACKAGE_FILE_NAME },
|
{ err, file: STORAGE.PACKAGE_FILE_NAME },
|
||||||
`'error reading' @{file}: @{!err.message}`
|
'error reading @{file}: @{err.message}'
|
||||||
);
|
);
|
||||||
|
|
||||||
throw errorUtils.getInternalError();
|
throw errorUtils.getInternalError();
|
||||||
|
|
Loading…
Reference in a new issue