#[non_exhaustive]pub struct PlatformCliError {
pub user_message: String,
pub raw_stderr: String,
pub hint: Option<String>,
pub doc_link: Option<String>,
pub code: Option<String>,
pub platform: Platform,
}Expand description
统一的底层平台 CLI 错误。
各平台 crate 的 parse_*_error() 函数返回此类型,
替代原先各自定义的 GhError、GlabError、GitcodeError。
用户可见信息(user_message、hint)为中文主导;
raw_stderr 仅用于 tracing::debug!,不展示给用户。
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.user_message: String用户可见的错误消息(中文主导)。
raw_stderr: String底层 CLI 原始 stderr(仅用于调试日志,不展示给用户)。
hint: Option<String>修复建议(中文)。
doc_link: Option<String>相关文档链接。
code: Option<String>平台错误代码(如 NOT_FOUND)。
platform: Platform来源平台。
Implementations§
Trait Implementations§
Source§impl Clone for PlatformCliError
impl Clone for PlatformCliError
Source§impl Debug for PlatformCliError
impl Debug for PlatformCliError
Source§impl Display for PlatformCliError
impl Display for PlatformCliError
Source§impl Error for PlatformCliError
impl Error for PlatformCliError
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<Box<PlatformCliError>> for CoreError
impl From<Box<PlatformCliError>> for CoreError
Source§fn from(source: Box<PlatformCliError>) -> Self
fn from(source: Box<PlatformCliError>) -> Self
Converts to this type from the input type.
Source§impl From<PlatformCliError> for CoreError
Ergonomic conversion from PlatformCliError into CoreError::Cli.
impl From<PlatformCliError> for CoreError
Ergonomic conversion from PlatformCliError into CoreError::Cli.
thiserror’s #[from] on Box<T> generates From<Box<T>>; this manual
impl lets callers write Err(platform_err.into()) without explicitly boxing.
Source§fn from(err: PlatformCliError) -> Self
fn from(err: PlatformCliError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Forget for PlatformCliError
impl Freeze for PlatformCliError
impl Move for PlatformCliError
impl RefUnwindSafe for PlatformCliError
impl Send for PlatformCliError
impl Sync for PlatformCliError
impl Unpin for PlatformCliError
impl UnsafeUnpin for PlatformCliError
impl UnwindSafe for PlatformCliError
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more