Commit 556cc61
authored
errors: Support contextual error handling strategies (#1246)
Currently `app_core::errors` handles synthesis of all error responses.
This means that this module needs to know about all possible error
types. To work around this, we wrap some errors with a special
`HttpError` type so this module can create a synthetic response.
Furthermore, this means that we can't handle errors differently in
inbound/outbound contexts.
This change modies the `error::respond` module with a new strategy
trait--`HttpRescue`--that is responsible for producing a
`SyntheticHttpResponse` if the error can be handled and returning an
error if it should not be handled gracefully.
This change enables us to perform narrower error handling in more places
in the stack--for example, so that some error responses are included in
response metrics.
This change modifies HTTP/1 error responses to include a `connection:
close` header when the server-side connection is being torn down.1 parent 47a5757 commit 556cc61
File tree
18 files changed
+481
-322
lines changed- linkerd
- app
- admin/src
- core/src/errors
- gateway/src
- inbound/src
- http
- policy
- authorize
- integration/src/tests
- outbound/src
- http
- error-respond/src
- proxy/http/src
18 files changed
+481
-322
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
85 | 84 | | |
86 | 85 | | |
87 | | - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
88 | 90 | | |
89 | 91 | | |
90 | 92 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | | - | |
| 10 | + | |
10 | 11 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
43 | 18 | | |
| 19 | + | |
44 | 20 | | |
0 commit comments