Skip to content

Commit

Permalink
Merge pull request #338 from NickDarvey/master
Browse files Browse the repository at this point in the history
Throw on parse error
  • Loading branch information
toddbluhm authored Nov 23, 2024
2 parents e02a21b + 66f3fa3 commit d6404f1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/get-env-vars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ export async function getRCFile (
}
throw new Error(errorText)
}
if (e.name === 'ParseError') {
if (verbose === true) {
console.info(e.message);
}
throw new Error(e.message);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/parse-rc-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export async function getRCFileVars (
parsedData = JSON.parse(file)
}
} catch (e) {
const parseError = new Error(`Failed to parse .rc file at path: ${absolutePath}`)
const parseError = new Error(`Failed to parse .rc file at path: ${absolutePath}.\n${e.message}`)
parseError.name = 'ParseError'
throw parseError
}
Expand Down

0 comments on commit d6404f1

Please sign in to comment.