AgentMuxError

Enum AgentMuxError 

Source
pub enum AgentMuxError {
Show 16 variants OutOfSpace { path: String, source_msg: String, }, PermissionDenied { path: String, source_msg: String, }, PathNotFound { path: String, }, PathTraversal { path: String, }, MigrationFailed { from: u32, to: u32, message: String, }, VersionMismatch { oid: String, expected: u64, actual: u64, }, CliNotInstalled { provider: String, cli: String, }, NpmInstallFailed { package: String, message: String, }, CliShimMissing { provider: String, expected_path: String, }, CliMissingOnPath { provider: String, cli: String, install_hint: String, }, AuthRequiresTty { provider: String, }, AuthTimeout { provider: String, seconds: u64, }, HttpError { url: String, status: Option<u16>, message: String, }, SidecarBindFailed { port: u16, message: String, }, AlreadyRunning { pid: u32, }, Legacy(String),
}
Expand description

The typed error returned by RPC handlers. Serializes to: { "code": "AMX-IO-001", "message": "device out of space ...", "details": { ... } }

Variants§

§

OutOfSpace

Fields

§path: String
§source_msg: String
§

PermissionDenied

Fields

§path: String
§source_msg: String
§

PathNotFound

Fields

§path: String
§

PathTraversal

Fields

§path: String
§

MigrationFailed

Fields

§from: u32
§to: u32
§message: String
§

VersionMismatch

Fields

§expected: u64
§actual: u64
§

CliNotInstalled

Fields

§provider: String
§

NpmInstallFailed

Fields

§package: String
§message: String
§

CliShimMissing

Fields

§provider: String
§expected_path: String
§

CliMissingOnPath

Fields

§provider: String
§install_hint: String
§

AuthRequiresTty

Fields

§provider: String
§

AuthTimeout

Fields

§provider: String
§seconds: u64
§

HttpError

Fields

§status: Option<u16>
§message: String
§

SidecarBindFailed

Fields

§port: u16
§message: String
§

AlreadyRunning

Fields

§pid: u32
§

Legacy(String)

Implementations§

Source§

impl AgentMuxError

Source

pub fn code(&self) -> AmxCode

Stable code for this variant. Mirrors the JSON code field the frontend’s catalog looks up.

Source

pub fn from_io_with_path(path: impl Into<String>, err: Error) -> Self

Helper for the common case: an std::io::Error raised while operating on a known path. Use this at call sites that have the path on hand — the From<std::io::Error> impl below can’t recover the path from the bare IO error.

Source

pub fn to_wire(&self) -> Value

Serializes the error into the wire format the RPC engine emits. Frontend pattern-matches on code.

Trait Implementations§

Source§

impl Debug for AgentMuxError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for AgentMuxError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for AgentMuxError

1.30.0 · Source§

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

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<&str> for AgentMuxError

Source§

fn from(s: &str) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for AgentMuxError

Source§

fn from(err: Error) -> Self

Implicit conversion routes by ErrorKind + raw OS code, but loses the path context. Prefer from_io_with_path at sites that know which file/dir was being operated on — the empty path here renders as the literal (unknown path) sentinel in Display, which leaks into wire message and the Details disclosure.

Source§

impl From<String> for AgentMuxError

Wrap a free-text string in AgentMuxError::Legacy. Used by the RPC engine to bridge un-migrated handlers that still return Result<_, String>.

Source§

fn from(s: String) -> Self

Converts to this type from the input type.
Source§

impl Serialize for AgentMuxError

Source§

fn serialize<S: Serializer>(&self, ser: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more