pub struct HttpError { /* private fields */ }Expand description
HTTP 错误包装类型
包装 WaeError 以提供 HTTP 响应转换。
Implementations§
Source§impl HttpError
impl HttpError
Sourcepub fn category(&self) -> ErrorCategory
pub fn category(&self) -> ErrorCategory
获取错误分类
Sourcepub fn invalid_token(reason: impl Into<String>) -> Self
pub fn invalid_token(reason: impl Into<String>) -> Self
创建无效令牌错误
Sourcepub fn token_expired() -> Self
pub fn token_expired() -> Self
创建令牌过期错误
Sourcepub fn permission_denied(action: impl Into<String>) -> Self
pub fn permission_denied(action: impl Into<String>) -> Self
创建权限拒绝错误
Sourcepub fn not_found(
resource_type: impl Into<String>,
identifier: impl Into<String>,
) -> Self
pub fn not_found( resource_type: impl Into<String>, identifier: impl Into<String>, ) -> Self
创建资源未找到错误
Sourcepub fn invalid_format(
field: impl Into<String>,
expected: impl Into<String>,
) -> Self
pub fn invalid_format( field: impl Into<String>, expected: impl Into<String>, ) -> Self
创建无效格式错误
Sourcepub fn into_response(self) -> Response<Body>
pub fn into_response(self) -> Response<Body>
转换为 HTTP 响应
Trait Implementations§
Source§impl Error for HttpError
impl Error for HttpError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for HttpError
impl RefUnwindSafe for HttpError
impl Send for HttpError
impl Sync for HttpError
impl Unpin for HttpError
impl UnsafeUnpin for HttpError
impl UnwindSafe for HttpError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more