#[non_exhaustive]pub struct ServerError {
pub code: ErrorCode,
pub description: Option<String>,
pub account_id: Option<AccountId>,
pub maintenance_end_timestamp: Option<i64>,
}Expand description
Error reported by the server in reply to a request.
The Debug output masks the account: it prints <masked> in place of the identifier, so
an error printed to a log or to the output of a test names no account. The Display
output carries the code and the explanation only. The account_id
field itself stays readable.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.code: ErrorCodeCode of the error, preserved as sent.
description: Option<String>Explanation given by the server, when there is one.
account_id: Option<AccountId>Account the error concerns, when the server names one.
maintenance_end_timestamp: Option<i64>End of the maintenance window in milliseconds since the Unix epoch, when announced.
Implementations§
Source§impl ServerError
impl ServerError
Sourcepub const fn new(code: ErrorCode) -> Self
pub const fn new(code: ErrorCode) -> Self
Describes an error with the given code and no further detail.
Sourcepub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
Adds the explanation given by the server.
Sourcepub const fn with_account_id(self, account_id: AccountId) -> Self
pub const fn with_account_id(self, account_id: AccountId) -> Self
Adds the account the error concerns.
Sourcepub const fn with_maintenance_end_timestamp(self, timestamp: i64) -> Self
pub const fn with_maintenance_end_timestamp(self, timestamp: i64) -> Self
Adds the end of the maintenance window, in milliseconds since the Unix epoch.
Trait Implementations§
Source§impl Clone for ServerError
impl Clone for ServerError
Source§impl Debug for ServerError
impl Debug for ServerError
Source§impl Display for ServerError
impl Display for ServerError
impl Eq for ServerError
Source§impl Error for ServerError
impl Error for ServerError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()