pub struct ErrorResponse {
pub error: ErrorDetail,
}Expand description
标准错误响应格式 / Standard error response format 格式: { “error”: { “code”: i32, “message”: str, “details”: object? } }
Fields§
§error: ErrorDetail错误详情 / Error detail
Implementations§
Source§impl ErrorResponse
impl ErrorResponse
Sourcepub fn with_detail(
self,
key: impl Into<String>,
value: impl Into<Value>,
) -> Self
pub fn with_detail( self, key: impl Into<String>, value: impl Into<Value>, ) -> Self
添加详情字段 / Add detail field
Sourcepub fn bad_request(message: impl Into<String>) -> Self
pub fn bad_request(message: impl Into<String>) -> Self
Bad Request 错误 / Bad Request error
Unauthorized 错误 / Unauthorized error
Sourcepub fn internal_error(message: impl Into<String>) -> Self
pub fn internal_error(message: impl Into<String>) -> Self
Internal Error 错误 / Internal Error error
Sourcepub fn tool_not_found(tool_name: impl Into<String>) -> Self
pub fn tool_not_found(tool_name: impl Into<String>) -> Self
Tool Not Found 错误 / Tool Not Found error
Sourcepub fn tool_execution_failed(message: impl Into<String>) -> Self
pub fn tool_execution_failed(message: impl Into<String>) -> Self
Tool Execution Failed 错误 / Tool Execution Failed error
Sourcepub fn tool_timeout(timeout_secs: u64) -> Self
pub fn tool_timeout(timeout_secs: u64) -> Self
Tool Timeout 错误 / Tool Timeout error
Sourcepub fn not_in_room() -> Self
pub fn not_in_room() -> Self
Not In Room 错误 / Not In Room error
Trait Implementations§
Source§impl Clone for ErrorResponse
impl Clone for ErrorResponse
Source§fn clone(&self) -> ErrorResponse
fn clone(&self) -> ErrorResponse
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 ErrorResponse
impl Debug for ErrorResponse
Source§impl<'de> Deserialize<'de> for ErrorResponse
impl<'de> Deserialize<'de> for ErrorResponse
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
Auto Trait Implementations§
impl Freeze for ErrorResponse
impl RefUnwindSafe for ErrorResponse
impl Send for ErrorResponse
impl Sync for ErrorResponse
impl Unpin for ErrorResponse
impl UnsafeUnpin for ErrorResponse
impl UnwindSafe for ErrorResponse
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