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.
2 parents ecee14c + 63cd933 commit 0953bfbCopy full SHA for 0953bfb
docs/patterns/error-handling.md
@@ -37,7 +37,7 @@ It's important that `onError` must be call before handler you want to apply
37
38
For example, returning custom 404 messages:
39
```typescript
40
-import { Elysia } from 'elysia'
+import { Elysia, NotFoundError } from 'elysia'
41
42
new Elysia()
43
.onError(({ code, error, set }) => {
@@ -47,6 +47,9 @@ new Elysia()
47
return 'Not Found :('
48
}
49
})
50
+ .post('/', () => {
51
+ throw new NotFoundError();
52
+ })
53
.listen(8080)
54
```
55
@@ -119,6 +122,9 @@ new Elysia()
119
122
return error
120
123
121
124
125
+ .get('/', () => {
126
+ throw new CustomError('Hello Error');
127
128
129
130
## Catching all error
0 commit comments