pub struct ErrorContext {
pub method: Method,
pub uri: Uri,
pub headers: HeaderMap,
pub ctx: AppContext,
pub request_id: Option<RequestId>,
pub route: Option<Arc<RouteMeta>>,
pub user: Option<Uuid>,
pub api_prefix: Arc<str>,
/* private fields */
}Expand description
What the pipeline knows about the request that ended in an error.
Fields§
§method: MethodThe request’s method.
uri: UriThe request’s URI, as it arrived.
headers: HeaderMapThe headers a page can depend on: Accept, Accept-Language, Cookie,
Host, User-Agent (a native client’s web view is known by it), the
Sec-Fetch-* and Sec-Purpose headers, X-Requested-With and every
X-Navree-* header. Nothing else is kept: not
Authorization, not an API key, not the body.
ctx: AppContextThe app.
request_id: Option<RequestId>The request id, when the request had one.
route: Option<Arc<RouteMeta>>The route the request belongs to: the one that handled it, or, for an error
raised before any route ran (a refused CSRF token, a limit, a 405), the route its
path and method name (for a 405, the route of the first method the path takes).
None when no route has that path.
user: Option<Uuid>The signed-in user, when the request reached authentication and had one.
A panic or a timeout cannot say, and leaves it None.
api_prefix: Arc<str>http.api_prefix: paths under it belong to the JSON API.
Implementations§
Source§impl ErrorContext
impl ErrorContext
Sourcepub fn new(method: Method, uri: Uri, ctx: AppContext) -> Self
pub fn new(method: Method, uri: Uri, ctx: AppContext) -> Self
A context for method and uri in the app ctx, with no headers, no request id, no
route and no user, and /api as the API prefix. Set the public fields for what your
test or tool knows.
Sourcepub fn is_api_path(&self) -> bool
pub fn is_api_path(&self) -> bool
Whether the request path is under http.api_prefix.
Sourcepub fn accepts(&self) -> Preference
pub fn accepts(&self) -> Preference
What the Accept header prefers.