From 60c30ece10349ab71ae15f37b6d6fc9951b38241 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 3 Mar 2019 08:00:39 +0900 Subject: [PATCH] Better logs --- src/services/drive/upload-from-url.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/services/drive/upload-from-url.ts b/src/services/drive/upload-from-url.ts index 1651afa271..558f020a34 100644 --- a/src/services/drive/upload-from-url.ts +++ b/src/services/drive/upload-from-url.ts @@ -47,7 +47,10 @@ export default async ( }); writable.on('error', error => { - logger.error(error); + logger.error(`Download failed: ${chalk.cyan(url)}: ${error}`, { + url: url, + e: error + }); rej(error); }); @@ -73,7 +76,10 @@ export default async ( }); req.on('error', error => { - logger.error(error); + logger.error(`Failed to start download: ${chalk.cyan(url)}: ${error}`, { + url: url, + e: error + }); writable.close(); rej(error); }); @@ -87,7 +93,10 @@ export default async ( logger.succ(`Got: ${driveFile._id}`); } catch (e) { error = e; - logger.error(`Failed: ${e}`); + logger.error(`Failed to create drive file: ${e}`, { + url: url, + e: e + }); } // clean-up