Update error handling doc to use promises+async
This commit is contained in:
parent
882ea7e87a
commit
1d1698eb85
1 changed files with 2 additions and 2 deletions
|
@ -6,9 +6,9 @@
|
||||||
this example prepends all error messages with "Error: "
|
this example prepends all error messages with "Error: "
|
||||||
|
|
||||||
```js
|
```js
|
||||||
app.use(function*(next){
|
app.use(async (ctx, next) => {
|
||||||
try {
|
try {
|
||||||
yield next;
|
await next();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
error.message = 'Error: ' + error.message;
|
error.message = 'Error: ' + error.message;
|
||||||
throw error;
|
throw error;
|
||||||
|
|
Loading…
Reference in a new issue