Describe the bug@pgtyped/cli does not respect the failOnError flag during generation.
Expected behavior
The workers should stop, and the process should exit with code 1.
Test case
In packages/example, add "failOnError": true to config.json
In any of the *.sql files, modify a statement to be incorrect.
Execute npm run typegen
The error will appear in the log, but execution does not stop, and echo $? returns 0
From my novice eye, it seems that this regression stems from e5f920e (as cdfadfba, the previous commit, is working as expected), specifically the changes in packages/cli/src/index.ts#L40.
I made a quick local test, replacing this.pool.run(opts, { name: functionName }); with
const result = await this.pool.run(opts, { name: functionName });
if (result.error) {
throw result.error;
}
return result;
Rerunning npm run typegen now behaves as expected, immediately stopping all workers as it encounters the erroneous file, and exiting with code 1.
Describe the bug
@pgtyped/cli
does not respect thefailOnError
flag during generation.Expected behavior The workers should stop, and the process should exit with code
1
.Test case
packages/example
, add"failOnError": true
toconfig.json
*.sql
files, modify a statement to be incorrect.npm run typegen
echo $?
returns0
From my novice eye, it seems that this regression stems from e5f920e (as cdfadfba, the previous commit, is working as expected), specifically the changes in
packages/cli/src/index.ts#L40
.I made a quick local test, replacing
this.pool.run(opts, { name: functionName });
withRerunning
npm run typegen
now behaves as expected, immediately stopping all workers as it encounters the erroneous file, and exiting with code1
.