pub struct DockerError {
pub kind: Box<DockerErrorKind>,
}Expand description
中心化错误类型
包含错误类型标识,支持国际化。
Fields§
§kind: Box<DockerErrorKind>错误类型
Implementations§
Source§impl DockerError
impl DockerError
Sourcepub fn new(kind: DockerErrorKind) -> Self
pub fn new(kind: DockerErrorKind) -> Self
创建新的错误
Sourcepub fn category(&self) -> ErrorCategory
pub fn category(&self) -> ErrorCategory
获取错误分类
Sourcepub fn http_status(&self) -> u16
pub fn http_status(&self) -> u16
获取 HTTP 状态码
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 out_of_range(
field: impl Into<String>,
min: Option<String>,
max: Option<String>,
) -> Self
pub fn out_of_range( field: impl Into<String>, min: Option<String>, max: Option<String>, ) -> Self
创建超出范围错误
Sourcepub fn invalid_credentials() -> Self
pub fn invalid_credentials() -> Self
创建无效凭证错误
Sourcepub fn account_locked() -> Self
pub fn account_locked() -> Self
创建账户已锁定错误
Sourcepub fn user_not_found(identifier: impl Into<String>) -> Self
pub fn user_not_found(identifier: impl Into<String>) -> Self
创建用户未找到错误
Sourcepub fn user_already_exists(username: impl Into<String>) -> Self
pub fn user_already_exists(username: impl Into<String>) -> Self
创建用户已存在错误
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 connection_failed(target: impl Into<String>) -> Self
pub fn connection_failed(target: impl Into<String>) -> Self
创建连接失败错误
创建服务不可用错误
Sourcepub fn storage_read_failed(path: impl Into<String>) -> Self
pub fn storage_read_failed(path: impl Into<String>) -> Self
创建存储读取失败错误
Sourcepub fn storage_write_failed(path: impl Into<String>) -> Self
pub fn storage_write_failed(path: impl Into<String>) -> Self
创建存储写入失败错误
Sourcepub fn storage_file_not_found(path: impl Into<String>) -> Self
pub fn storage_file_not_found(path: impl Into<String>) -> Self
创建存储文件未找到错误
Sourcepub fn config_missing(key: impl Into<String>) -> Self
pub fn config_missing(key: impl Into<String>) -> Self
创建配置缺失错误
Sourcepub fn not_implemented(feature: impl Into<String>) -> Self
pub fn not_implemented(feature: impl Into<String>) -> Self
创建未实现错误
Sourcepub fn json_error(reason: impl Into<String>) -> Self
pub fn json_error(reason: impl Into<String>) -> Self
创建 JSON 错误
Sourcepub fn container_error(reason: impl Into<String>) -> Self
pub fn container_error(reason: impl Into<String>) -> Self
创建容器错误
Sourcepub fn image_error(reason: impl Into<String>) -> Self
pub fn image_error(reason: impl Into<String>) -> Self
创建镜像错误
Sourcepub fn network_error(reason: impl Into<String>) -> Self
pub fn network_error(reason: impl Into<String>) -> Self
创建网络错误
Sourcepub fn runtime_error(reason: impl Into<String>) -> Self
pub fn runtime_error(reason: impl Into<String>) -> Self
创建运行时错误
Sourcepub fn registry_error(reason: impl Into<String>) -> Self
pub fn registry_error(reason: impl Into<String>) -> Self
创建注册表错误
Sourcepub fn etcd_error(reason: impl Into<String>) -> Self
pub fn etcd_error(reason: impl Into<String>) -> Self
创建 Etcd 错误
Sourcepub fn monitor_error(reason: impl Into<String>) -> Self
pub fn monitor_error(reason: impl Into<String>) -> Self
创建监控错误
Sourcepub fn kubernetes_error(reason: impl Into<String>) -> Self
pub fn kubernetes_error(reason: impl Into<String>) -> Self
创建 Kubernetes 错误
Trait Implementations§
Source§impl Clone for DockerError
impl Clone for DockerError
Source§fn clone(&self) -> DockerError
fn clone(&self) -> DockerError
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DockerError
impl Debug for DockerError
Source§impl<'de> Deserialize<'de> for DockerError
impl<'de> Deserialize<'de> for DockerError
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for DockerError
impl Display for DockerError
Source§impl Error for DockerError
impl Error for DockerError
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()
Source§impl From<Error> for DockerError
impl From<Error> for DockerError
Source§impl From<Error> for DockerError
impl From<Error> for DockerError
Auto Trait Implementations§
impl Freeze for DockerError
impl RefUnwindSafe for DockerError
impl Send for DockerError
impl Sync for DockerError
impl Unpin for DockerError
impl UnsafeUnpin for DockerError
impl UnwindSafe for DockerError
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