(core) Reduce a few log levels to warning

Summary: Reduces the log level in a few places from error to warning.

Test Plan: N/A

Reviewers: paulfitz

Reviewed By: paulfitz

Subscribers: paulfitz

Differential Revision: https://phab.getgrist.com/D3437
This commit is contained in:
George Gevoian 2022-05-18 14:06:38 -07:00
parent 3ddeb511e8
commit bad4c68569
2 changed files with 10 additions and 2 deletions

View File

@ -75,7 +75,11 @@ export class DocWorker {
return res.type('application/x-sqlite3')
.download(tmpPath, (optStringParam(req.query.title) || docTitle || 'document') + ".grist", async (err: any) => {
if (err) {
log.error(`Download failure for doc ${docId}`, err);
if (err.message && /Request aborted/.test(err.message)) {
log.warn(`Download request aborted for doc ${docId}`, err);
} else {
log.error(`Download failure for doc ${docId}`, err);
}
}
await fse.unlink(tmpPath);
});

View File

@ -54,7 +54,11 @@ export function addUploadRoute(server: GristServer, expressApp: Application, ...
res.status(200).send(JSON.stringify(uploadResult));
} catch (err) {
req.resume();
log.error("Error uploading file", err);
if (err.message && /Request aborted/.test(err.message)) {
log.warn("File upload request aborted", err);
} else {
log.error("Error uploading file", err);
}
// Respond with a JSON error like jsonErrorHandler does for API calls,
// to make it easier for the caller to parse it.
res.status(err.status || 500).json({error: err.message || 'internal error'});