graphcool-templates
graphcool-templates copied to clipboard
Use reject to prevent errors from being swallowed
When an error is thrown inside a Promise it normally rejects, but if the error is thrown from inside a callback, i.e. in an async manner, the only way to make the Promise reject is to call the reject callback, otherwise the Error thrown ends up nowhere and the Promise never resolves or rejects, resulting in weird errors on Graphcool (which could handle this better too)...
This PR uses the reject callback to solve this problem.