pub struct ErrorCode(/* private fields */);Expand description
A JSON-RPC error code.
This is the integer on the wire. It is not tied to one ACP version: it
can hold any i32, converts to and from i32, and converts losslessly to
and from v1::schema::ErrorCode and
v2::schema::ErrorCode. It can also be compared with either schema enum
directly:
use agent_client_protocol::{Error, ErrorCode, v1::schema};
let error = Error::invalid_params();
assert_eq!(error.code, ErrorCode::INVALID_PARAMS);
assert_eq!(error.code, schema::ErrorCode::InvalidParams);
assert_eq!(i32::from(error.code), -32602);The associated constants cover the codes that every ACP version defines
the same way. Codes defined by only some versions, such as v2’s -32022
(Unsupported protocol version), are on that version’s ErrorCode.
Implementations§
Source§impl ErrorCode
impl ErrorCode
Sourcepub const PARSE_ERROR: Self
pub const PARSE_ERROR: Self
-32700: invalid JSON was received.
Sourcepub const INVALID_REQUEST: Self
pub const INVALID_REQUEST: Self
-32600: the JSON sent is not a valid request object.
Sourcepub const METHOD_NOT_FOUND: Self
pub const METHOD_NOT_FOUND: Self
-32601: the method does not exist or is not available.
Sourcepub const INVALID_PARAMS: Self
pub const INVALID_PARAMS: Self
-32602: invalid method parameters.
Sourcepub const INTERNAL_ERROR: Self
pub const INTERNAL_ERROR: Self
-32603: internal JSON-RPC error.
Sourcepub const REQUEST_CANCELLED: Self
pub const REQUEST_CANCELLED: Self
-32800: the request was cancelled.
Sourcepub const AUTH_REQUIRED: Self
pub const AUTH_REQUIRED: Self
-32000: authentication is required first.
Sourcepub const RESOURCE_NOT_FOUND: Self
pub const RESOURCE_NOT_FOUND: Self
-32002: a resource, such as a session or file, was not found.
The error data for this code differs between protocol versions; build it with the schema types’ constructors.
Trait Implementations§
impl Copy for ErrorCode
Source§impl<'de> Deserialize<'de> for ErrorCode
impl<'de> Deserialize<'de> for ErrorCode
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>,
impl Eq for ErrorCode
Source§impl JsonSchema for ErrorCode
Available on crate feature schemars only.
impl JsonSchema for ErrorCode
schemars only.Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl Ord for ErrorCode
impl Ord for ErrorCode
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for ErrorCode
impl PartialOrd for ErrorCode
impl StructuralPartialEq for ErrorCode
Auto Trait Implementations§
impl Freeze for ErrorCode
impl RefUnwindSafe for ErrorCode
impl Send for ErrorCode
impl Sync for ErrorCode
impl Unpin for ErrorCode
impl UnsafeUnpin for ErrorCode
impl UnwindSafe for ErrorCode
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.