Last active
January 13, 2019 11:06
-
-
Save philsch/b7d451b740b73437788a0d0a15ddf677 to your computer and use it in GitHub Desktop.
Blogpost: Monitor your GraphQL Apollo Server in Google Cloud
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
const simulateDbDown = async () => { | |
if (Math.random() > 0.7) { | |
throw new DatabaseError('[TEST] Oh no the database is down!'); | |
} | |
}; | |
const resolvers = { | |
Query: { | |
books: async (parent, args) => { | |
await simulateDbDown(); | |
if (!args.author) { | |
return exampleBooks; | |
} | |
return exampleBooks.filter((el) => el.author === args.author); | |
} | |
} | |
}; | |
// ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment