RelayCompilerMain.js uncatchable errors
- Dominant language
- Rust
- Stars
- 19k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
I'm using relay-compiler as library directly in my node javascript code and not the cli to automatically re-run relay-compiler when a change is detected. If there are no errors, continue recompiling rest of the javascript code using webpack. If error is detected, print out the error and wait for new changes.
```javascript
import { main } from 'relay-compiler/lib/RelayCompilerMain';
try {
main({
schema,
src,
// ... etc
}).catch(e => {
console.error(e);
});
} catch(e) {
console.error(e);
};
```
The piece of code above is unable to catch RelayParser errors thrown inside RelayCompilerMain.js and terminates the process with:
```
RelayParser: Encountered 1 error(s):
- Unknown field 'title' on type 'Post'. Source: document `usePost_post` file: `hooks/usePost.js`
hooks/usePost.js:7:5
6 | title
7 | content
| ^
8 | }
```
I'm using relay-compiler v5.0.0
Contributor guide
Assessment
This issue has not been assessed yet.