1
2
3
4
5
6
7
8
9
10
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//! Reporting and rendering errors.
//!
//! When a handler returns an error, the error handler logs the error if it's a failure and
//! renders it as a response. Requests that expect JSON get a JSON response, and other requests
//! get an error page. Configure the handler with [`Errors`], and give your own error types a
//! status with the [`Status`] derive. To learn more, check out the
//! [error handling guide](https://github.com/laravel/rust-framework/blob/0.x/docs/errors.md).
//!
//! # Rendering
//!
//! The error handler renders an error where it happens, with the request as the
//! route's handler received it, so a renderer can read what middleware set up,
//! such as the session. The response then passes back out through the route's
//! middleware. Headers returned alongside an error, such as
//! `([(header::RETRY_AFTER, "60")], abort(429))`, stay on the response.
//!
//! A JSON client error's message comes from the error that set its status. That
//! is the `abort` message, or the message of the error whose type has the status.
//! The response leaves out [context](crate::Error::context). Outside debug mode,
//! a failure's message is "Server Error", unless `abort_with` raised it. An
//! error page shows the status's reason, such as "Not Found", and a `403` page
//! also shows the error's message.
//!
//! An error view for the status, such as `errors/404`, takes precedence over
//! one for its class, such as `errors/4xx`. When no view matches, or the view
//! fails to render, the built-in page renders instead.
//!
//! # The debug page
//!
//! With `APP_DEBUG` on, failures render a page with the error, its type and
//! location, the errors that caused it, the route, and the request. Expected
//! outcomes, such as a `404`, render as usual. The page highlights the first
//! frame of the application's own code in the stack trace, skipping framework
//! code and the `vendor` and `target` directories, and shows a failed
//! template's source.
//!
//! Some errors point to the code that caused them. A missing view points to its
//! `view(..)` or `route.view(..)` call. An unregistered service points to the
//! route registration for an `Inject<T>` argument, or to the `resolve::<T>()`
//! call. An undefined database connection points to the connection lookup. The stack
//! trace is the current thread's, so an error in a spawned task can't point
//! back to the code that spawned it, and a release build without debug
//! symbols may have no frames to show. Without a frame of the application's
//! own, the page shows where the error was converted, or where a panic
//! happened.
//!
//! # Panicking handlers
//!
//! A panic in a handler renders as a `500`, the same as a returned failure, and
//! the error handler reports it with the file and line where it happened.
//! The handler also reports a panic in an error renderer or error page, and
//! answers it with a built-in `500`. In debug mode, that response is JSON with
//! the panic message, whatever the request accepts. Otherwise, it's a plain
//! "Server Error". A panic while a streamed response body is sent comes after
//! the status, so the error handler reports it and ends the response early.
pub use __Status;
pub use *;
pub use ;