Skip to content

Commit 6a2ec85

Browse files
authored
Throw an error if the requested config file does not exist/is not found (#1231)
feat: throw error if requested config file not found
1 parent d6e362a commit 6a2ec85

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/cli/flowr.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import { repl, replProcessAnswer } from './repl/core';
2727
import { printVersionInformation } from './repl/commands/repl-version';
2828
import { printVersionRepl } from './repl/print-version';
2929
import { defaultConfigFile, flowrMainOptionDefinitions, getScriptsText } from './flowr-main-options';
30+
import fs from 'fs';
3031

3132
export const toolName = 'flowr';
3233

@@ -87,6 +88,13 @@ if(options['config-json']) {
8788
}
8889
}
8990
if(!usedConfig) {
91+
if(options['config-file']) {
92+
// validate it exists
93+
if(!fs.existsSync(options['config-file'])) {
94+
log.error(`Config file '${options['config-file']}' does not exist`);
95+
process.exit(1);
96+
}
97+
}
9098
setConfigFile(options['config-file'] ?? defaultConfigFile, undefined, true);
9199
}
92100

0 commit comments

Comments
 (0)