Merge pull request #338 from NickDarvey/master

Throw on parse error
This commit is contained in:
Todd Bluhm 2024-11-23 05:50:22 -06:00 committed by GitHub
commit d6404f1f01
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View File

@ -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);
}
}
}

View File

@ -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
}