From dea17d604296399a5af19883936be420799e93a0 Mon Sep 17 00:00:00 2001 From: Alexander Fenster Date: Tue, 5 May 2020 17:26:08 -0700 Subject: [PATCH 1/3] fix: misleading error message If `tsconfig.json` cannot be parsed, don't say it's not found. --- src/util.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/util.ts b/src/util.ts index f66a0995..4b5bb652 100644 --- a/src/util.ts +++ b/src/util.ts @@ -76,6 +76,10 @@ async function getBase( readFiles.add(filePath); try { const json = await customReadFilep(filePath, 'utf8'); + } catch (err) { + throw new Error(`${filePath} not found`); + } + try { let contents = JSON.parse(json); if (contents.extends) { @@ -91,7 +95,7 @@ async function getBase( return contents; } catch (err) { - throw new Error(`${filePath} Not Found`); + throw new Error(`${filePath} cannot be parsed`); } } From a81e5e75c45db39508df9fb6b0417bf25f2f2e34 Mon Sep 17 00:00:00 2001 From: Alexander Fenster Date: Tue, 5 May 2020 17:30:28 -0700 Subject: [PATCH 2/3] fix: just print error --- src/util.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/util.ts b/src/util.ts index 4b5bb652..0ff1b85c 100644 --- a/src/util.ts +++ b/src/util.ts @@ -76,10 +76,6 @@ async function getBase( readFiles.add(filePath); try { const json = await customReadFilep(filePath, 'utf8'); - } catch (err) { - throw new Error(`${filePath} not found`); - } - try { let contents = JSON.parse(json); if (contents.extends) { @@ -95,7 +91,7 @@ async function getBase( return contents; } catch (err) { - throw new Error(`${filePath} cannot be parsed`); + throw new Error(`Error: ${filePath}: ${err}`); } } From feb37d3debe5aeb093d849fac27d686088926769 Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Mon, 8 Jun 2020 18:57:02 -0700 Subject: [PATCH 3/3] poke it --- src/util.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/util.ts b/src/util.ts index 0ff1b85c..b86a6232 100644 --- a/src/util.ts +++ b/src/util.ts @@ -91,7 +91,8 @@ async function getBase( return contents; } catch (err) { - throw new Error(`Error: ${filePath}: ${err}`); + err.message = `Error: ${filePath}\n${err.message}`; + throw err; } }