mirror of
https://github.com/Kong/insomnia
synced 2024-11-07 22:30:15 +00:00
Catch graphql schema render errors
This commit is contained in:
parent
22d0346864
commit
1cd827c6bb
@ -81,7 +81,7 @@ class GraphQLEditor extends React.PureComponent {
|
||||
this.setState({schemaIsFetching: true});
|
||||
|
||||
const {workspace, settings, environmentId} = this.props;
|
||||
const request: RenderedRequest = await getRenderedRequest(rawRequest, environmentId);
|
||||
|
||||
const newState = {
|
||||
schema: this.state.schema,
|
||||
schemaFetchError: '',
|
||||
@ -89,6 +89,15 @@ class GraphQLEditor extends React.PureComponent {
|
||||
schemaIsFetching: false
|
||||
};
|
||||
|
||||
let request: RenderedRequest;
|
||||
try {
|
||||
request = await getRenderedRequest(rawRequest, environmentId);
|
||||
} catch (err) {
|
||||
newState.schemaFetchError = `Failed to fetch schema: ${err}`;
|
||||
this.setState(newState);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
// TODO: Use Insomnia's network stack to handle things like authentication
|
||||
const bodyJson = JSON.stringify({query: introspectionQuery});
|
||||
|
Loading…
Reference in New Issue
Block a user