Skip to content

Commit

Permalink
added try catch when calling IntrospectionQuery
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Dawson committed Sep 25, 2023
1 parent 4edbd43 commit b1258c8
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/services/workflow.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,18 @@ class WorkflowService {
async loadTypes () {
// TODO: this assumes all workflows use the same schema which is and
// isn't necessarily true, not quite sure, come back to this later.
const response = await this.apolloClient.query({
query: getIntrospectionQuery(),
fetchPolicy: 'no-cache'
})
let response = null
try {
response = await this.apolloClient.query({
query: getIntrospectionQuery(),
fetchPolicy: 'no-cache'
})
} catch (err) {
console.error(err)
console.log('retrying')
await new Promise(resolve => setTimeout(resolve, 2000))
return this.loadTypes()

Check warning on line 169 in src/services/workflow.service.js

View check run for this annotation

Codecov / codecov/patch

src/services/workflow.service.js#L166-L169

Added lines #L166 - L169 were not covered by tests
}
const mutations = response.data.__schema.mutationType.fields
const queries = response.data.__schema.queryType.fields
const { types } = response.data.__schema
Expand Down

0 comments on commit b1258c8

Please sign in to comment.