Skip to content

Instantly share code, notes, and snippets.

@adrianhall
Created December 19, 2018 17:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adrianhall/b62c5436588d0160077fa24b14295bd8 to your computer and use it in GitHub Desktop.
Save adrianhall/b62c5436588d0160077fa24b14295bd8 to your computer and use it in GitHub Desktop.
## Raise a GraphQL field error in case of a datasource invocation error
#if($ctx.error)
$util.error($ctx.error.message, $ctx.error.type)
#end
#set($result = {})
$util.qr($result.put("totalCount", $ctx.prev.result.totalCount))
$util.qr($result.put("nextToken",$ctx.prev.result.nextToken))
$util.qr($result.put("items", $ctx.result.data.devRestaurantReviews))
$util.toJson($result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment