We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0c75b92 commit 7aa6088Copy full SHA for 7aa6088
README.md
@@ -103,16 +103,21 @@ exports.handler = router.handler({
103
{
104
path: '/graphql',
105
method: 'POST',
106
- action: (request, context) => doAnything(request.body)
+ action: (request, context) => doThrowAnException(request.body)
107
}
108
],
109
debug: true,
110
errorMapping: {
111
'NotFound': 404,
112
+ 'MyCustomError': 429,
113
'ServerError': 500
114
115
116
});
117
+
118
+function doThrowAnException(body) {
119
+ throw {reason: 'MyCustomError', message: 'Throw an error for this example'}
120
+}
121
```
122
123
With the key word `errorMapping` shown in the example above you can custom mapping of thrown errors to http response code error.
0 commit comments