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 new(code: i32, message: impl Into<String>) -> ErrorResponse
pub fn new(code: i32, message: impl Into<String>) -> ErrorResponse
创建新的错误响应 / Create new error response
Sourcepub fn with_detail(
self,
key: impl Into<String>,
value: impl Into<Value>,
) -> ErrorResponse
pub fn with_detail( self, key: impl Into<String>, value: impl Into<Value>, ) -> ErrorResponse
添加详情字段 / Add detail field
Sourcepub fn bad_request(message: impl Into<String>) -> ErrorResponse
pub fn bad_request(message: impl Into<String>) -> ErrorResponse
Bad Request 错误 / Bad Request error
Unauthorized 错误 / Unauthorized error
Sourcepub fn forbidden(message: impl Into<String>) -> ErrorResponse
pub fn forbidden(message: impl Into<String>) -> ErrorResponse
Forbidden 错误 / Forbidden error
Sourcepub fn not_found(message: impl Into<String>) -> ErrorResponse
pub fn not_found(message: impl Into<String>) -> ErrorResponse
Not Found 错误 / Not Found error
Sourcepub fn timeout(message: impl Into<String>) -> ErrorResponse
pub fn timeout(message: impl Into<String>) -> ErrorResponse
Timeout 错误 / Timeout error
Sourcepub fn internal_error(message: impl Into<String>) -> ErrorResponse
pub fn internal_error(message: impl Into<String>) -> ErrorResponse
Internal Error 错误 / Internal Error error
Sourcepub fn tool_not_found(tool_name: impl Into<String>) -> ErrorResponse
pub fn tool_not_found(tool_name: impl Into<String>) -> ErrorResponse
Tool Not Found 错误 / Tool Not Found error
Sourcepub fn tool_execution_failed(message: impl Into<String>) -> ErrorResponse
pub fn tool_execution_failed(message: impl Into<String>) -> ErrorResponse
Tool Execution Failed 错误 / Tool Execution Failed error
Sourcepub fn tool_timeout(timeout_secs: u64) -> ErrorResponse
pub fn tool_timeout(timeout_secs: u64) -> ErrorResponse
Tool Timeout 错误 / Tool Timeout error
Sourcepub fn room_full(office_id: impl Into<String>) -> ErrorResponse
pub fn room_full(office_id: impl Into<String>) -> ErrorResponse
Room Full 错误 / Room Full error
Sourcepub fn not_in_room() -> ErrorResponse
pub fn not_in_room() -> ErrorResponse
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<ErrorResponse, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ErrorResponse, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for ErrorResponse
impl Serialize for ErrorResponse
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. 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