From bad4c68569420dc86f88ea483fddecbf6f6eaf4d Mon Sep 17 00:00:00 2001 From: George Gevoian Date: Wed, 18 May 2022 14:06:38 -0700 Subject: [PATCH] (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 --- app/server/lib/DocWorker.ts | 6 +++++- app/server/lib/uploads.ts | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/server/lib/DocWorker.ts b/app/server/lib/DocWorker.ts index a7e78274..24cdf7c4 100644 --- a/app/server/lib/DocWorker.ts +++ b/app/server/lib/DocWorker.ts @@ -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); }); diff --git a/app/server/lib/uploads.ts b/app/server/lib/uploads.ts index 9dbdfd45..ef74597a 100644 --- a/app/server/lib/uploads.ts +++ b/app/server/lib/uploads.ts @@ -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'});