pub struct EndpointError {
pub status: u16,
pub code: String,
pub message: String,
}Expand description
Error response returned by a handler.
CCF sends an OData JSON error with this code and message, which are visible to the client and may be empty. A status that is not a known HTTP status of 400 or above is sent as HTTP 500.
use ccf_app::EndpointError;
let error = EndpointError::new(404, "ResourceNotFound", "No such key");
assert_eq!(error.status, 404);Fields§
§status: u16HTTP status.
code: StringError code, such as "ResourceNotFound".
message: StringError message.
Implementations§
Trait Implementations§
Source§impl Clone for EndpointError
impl Clone for EndpointError
Source§fn clone(&self) -> EndpointError
fn clone(&self) -> EndpointError
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 EndpointError
impl Debug for EndpointError
Source§impl From<BridgeError> for EndpointError
Convert to an HTTP 500 InternalError, so that ? can be used in handlers.
impl From<BridgeError> for EndpointError
Convert to an HTTP 500 InternalError, so that ? can be used in handlers.
use ccf_app::{BridgeError, EndpointError};
let error = EndpointError::from(BridgeError::InvalidArgument);
assert_eq!(error.status, 500);
assert_eq!(error.message, "CCF bridge error: InvalidArgument");Source§fn from(error: BridgeError) -> Self
fn from(error: BridgeError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for EndpointError
impl RefUnwindSafe for EndpointError
impl Send for EndpointError
impl Sync for EndpointError
impl Unpin for EndpointError
impl UnsafeUnpin for EndpointError
impl UnwindSafe for EndpointError
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