dotansimha / dotansimha/graphql-code-generator
[cli] Add onError callback to handle runtime errors
- Dominant language
- TypeScript
- Stars
- 11.3k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 23
Description
### Is your feature request related to a problem? Please describe.
It could be useful to have a way to trigger functionalities when errors happen while running codegen.
Some uses cases:
- Write errors to a file when schema fails to load (usually by `@graphql-codegen/cli`)
- If plugins or presets encounters runtime error, report extra context with the thrown error
### Describe the solution you'd like
```
const config: CodegenConfig = {
generates: {
"src/types": {
plugins: ['typescript'],
onError: (error) => { // add a callback to handle arbitrary thrown errors during runtime. This could be loader errors or plugin runtime errors, etc.
// handle error
}
}
},
}
```
### Describe alternatives you've considered
_No response_
### Any additional important details?
_No response_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.