#[non_exhaustive]pub struct WsRequestError {
pub request_id: Option<String>,
pub problem: ProblemDetails,
}Expand description
A request-level error sent over the WebSocket (RFC 8887 §4.3.4): an
RFC 8620 §3.6.1 problem details object plus @type: "RequestError"
and requestId.
requestId is always written, as null when None, the way the
RFC 8887 §4.4 notJSON example writes it for a message the server
could not read an id from. It “MUST be returned if given in the
request”.
use jmap_websocket::WsRequestError;
use jmap_websocket::jmap_types::problem::ProblemDetails;
let e = WsRequestError::new(
ProblemDetails::new("urn:ietf:params:jmap:error:notJSON", 400),
None,
);
let v = serde_json::to_value(&e).unwrap();
assert_eq!(v["@type"], "RequestError");
assert!(v["requestId"].is_null());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.request_id: Option<String>requestId: the id of the request this error answers.
problem: ProblemDetailsThe problem details (type, status, title, detail, limit,
extension members).
Implementations§
Source§impl WsRequestError
impl WsRequestError
Sourcepub fn new(problem: ProblemDetails, request_id: Option<String>) -> Self
pub fn new(problem: ProblemDetails, request_id: Option<String>) -> Self
An error frame carrying problem for the request with id
request_id.
Trait Implementations§
Source§impl Clone for WsRequestError
impl Clone for WsRequestError
Source§impl Debug for WsRequestError
impl Debug for WsRequestError
Source§impl<'de> Deserialize<'de> for WsRequestError
impl<'de> Deserialize<'de> for WsRequestError
Source§fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for WsRequestError
impl PartialEq for WsRequestError
Source§impl Serialize for WsRequestError
impl Serialize for WsRequestError
impl StructuralPartialEq for WsRequestError
Auto Trait Implementations§
impl Forget for WsRequestError
impl Freeze for WsRequestError
impl Move for WsRequestError
impl RefUnwindSafe for WsRequestError
impl Send for WsRequestError
impl Sync for WsRequestError
impl Unpin for WsRequestError
impl UnsafeUnpin for WsRequestError
impl UnwindSafe for WsRequestError
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