Don't swallow errors (#384)

* Change 'pattern does not match any files' warning to fatal

Fixes #383

* Raise a fatal error if the config file is not valid

Related to #383
This commit is contained in:
Ryan Delaney 2024-03-08 21:10:05 +00:00 committed by GitHub
parent 9150ab13f3
commit fe71fd3b91
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -25,7 +25,7 @@ async function run() {
if (config.input_files) {
const patterns = unmatchedPatterns(config.input_files);
patterns.forEach((pattern) =>
console.warn(`🤔 Pattern '${pattern}' does not match any files.`)
throw new Error(`⚠️ Pattern '${pattern}' does not match any files.`)
);
if (patterns.length > 0 && config.input_fail_on_unmatched_files) {
throw new Error(`⚠️ There were unmatched files`);
@ -63,7 +63,7 @@ async function run() {
if (config.input_files && config.input_files.length > 0) {
const files = paths(config.input_files);
if (files.length == 0) {
console.warn(`🤔 ${config.input_files} not include valid file.`);
throw new Error(`⚠️ ${config.input_files} not include valid file.`);
}
const currentAssets = rel.assets;
const assets = await Promise.all(