Skip to content

Commit d6404f1

Browse files
authored
Merge pull request #338 from NickDarvey/master
Throw on parse error
2 parents e02a21b + 66f3fa3 commit d6404f1

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/get-env-vars.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@ export async function getRCFile (
103103
}
104104
throw new Error(errorText)
105105
}
106+
if (e.name === 'ParseError') {
107+
if (verbose === true) {
108+
console.info(e.message);
109+
}
110+
throw new Error(e.message);
111+
}
106112
}
107113
}
108114

src/parse-rc-file.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export async function getRCFileVars (
3434
parsedData = JSON.parse(file)
3535
}
3636
} catch (e) {
37-
const parseError = new Error(`Failed to parse .rc file at path: ${absolutePath}`)
37+
const parseError = new Error(`Failed to parse .rc file at path: ${absolutePath}.\n${e.message}`)
3838
parseError.name = 'ParseError'
3939
throw parseError
4040
}

0 commit comments

Comments
 (0)