pub struct ApigateError { /* private fields */ }Expand description
Error returned from hooks and maps.
Framework errors are rendered through the configured error renderer.
Custom responses created with Self::from_response bypass that renderer.
Implementations§
Source§impl ApigateError
impl ApigateError
Sourcepub fn new(
status: StatusCode,
message: impl Into<Cow<'static, str>>,
) -> ApigateError
pub fn new( status: StatusCode, message: impl Into<Cow<'static, str>>, ) -> ApigateError
Creates a framework-rendered HTTP error with a custom status and message.
Sourcepub fn bad_request(message: impl Into<Cow<'static, str>>) -> ApigateError
pub fn bad_request(message: impl Into<Cow<'static, str>>) -> ApigateError
Creates a 400 Bad Request framework-rendered error.
Creates a 401 Unauthorized framework-rendered error.
Sourcepub fn forbidden(message: impl Into<Cow<'static, str>>) -> ApigateError
pub fn forbidden(message: impl Into<Cow<'static, str>>) -> ApigateError
Creates a 403 Forbidden framework-rendered error.
Sourcepub fn payload_too_large(message: impl Into<Cow<'static, str>>) -> ApigateError
pub fn payload_too_large(message: impl Into<Cow<'static, str>>) -> ApigateError
Creates a 413 Payload Too Large framework-rendered error.
Sourcepub fn unsupported_media_type(
message: impl Into<Cow<'static, str>>,
) -> ApigateError
pub fn unsupported_media_type( message: impl Into<Cow<'static, str>>, ) -> ApigateError
Creates a 415 Unsupported Media Type framework-rendered error.
Sourcepub fn bad_gateway(message: impl Into<Cow<'static, str>>) -> ApigateError
pub fn bad_gateway(message: impl Into<Cow<'static, str>>) -> ApigateError
Creates a 502 Bad Gateway framework-rendered error.
Sourcepub fn gateway_timeout(message: impl Into<Cow<'static, str>>) -> ApigateError
pub fn gateway_timeout(message: impl Into<Cow<'static, str>>) -> ApigateError
Creates a 504 Gateway Timeout framework-rendered error.
Sourcepub fn internal(message: impl Into<Cow<'static, str>>) -> ApigateError
pub fn internal(message: impl Into<Cow<'static, str>>) -> ApigateError
Creates a 500 Internal Server Error framework-rendered error.
Sourcepub fn from_response(response: impl IntoResponse) -> ApigateError
pub fn from_response(response: impl IntoResponse) -> ApigateError
Stores a fully custom HTTP response. Useful for domain-specific JSON error payloads.
Sourcepub fn json<T>(status: StatusCode, body: T) -> ApigateErrorwhere
Json<T>: IntoResponse,
pub fn json<T>(status: StatusCode, body: T) -> ApigateErrorwhere
Json<T>: IntoResponse,
Stores a JSON response with a custom HTTP status.
Sourcepub fn bad_request_json<T>(body: T) -> ApigateErrorwhere
Json<T>: IntoResponse,
pub fn bad_request_json<T>(body: T) -> ApigateErrorwhere
Json<T>: IntoResponse,
Stores a JSON response with 400 Bad Request.
Stores a JSON response with 401 Unauthorized.
Sourcepub fn forbidden_json<T>(body: T) -> ApigateErrorwhere
Json<T>: IntoResponse,
pub fn forbidden_json<T>(body: T) -> ApigateErrorwhere
Json<T>: IntoResponse,
Stores a JSON response with 403 Forbidden.