Async function error handling #493
-
The documentation states:
What's the recommended practice if you must? Consider a simple handler relying upon an Askama template, temporarily with incomplete error handling:
As this is a necessary resource for the server to operate, this appears to be a valid case of server error and not covered by request-oriented errors discussed in https://docs.rs/axum/0.3.2/axum/error_handling/index.html#axums-error-handling-model. Is my understanding correct? If it is, how should async function handlers properly address server errors? Simply using a |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 13 replies
-
You have to handle the error somehow and return an appropriate response to the client. You can return Note this still isn't an "error" in the |
Beta Was this translation helpful? Give feedback.
You have to handle the error somehow and return an appropriate response to the client. You can return
Result<T, E>
if both types implementIntoResponse
.Note this still isn't an "error" in the
tower::Service
sense since a response is still generated and sent back to the client.