Enum NutError

Source
pub enum NutError {
Show 28 variants AccessDenied, UnknownUps, VarNotSupported, CmdNotSupported, InvalidArgument, InstCmdFailed, SetFailed, ReadOnly, TooLong, FeatureNotSupported, AlreadySslMode, DriverNotConnected, DataStale, AlreadyLoggedIn, InvalidPassword, AlreadySetPassword, InvalidUsername, AlreadySetUsername, UsernameRequired, PasswordRequired, UnknownCommand, InvalidValue, UnexpectedResponse, UnknownResponseType(String), SslNotSupported, SslInvalidHostname, FeatureNotConfigured, Generic(String),
}
Expand description

A NUT-native error.

Variants§

§

AccessDenied

Occurs when the username/password combination is rejected.

§

UnknownUps

Occurs when the specified UPS device does not exist.

§

VarNotSupported

The specified UPS doesn’t support the variable in the request.

§

CmdNotSupported

The specified UPS doesn’t support the instant command in the request.

§

InvalidArgument

The client sent an argument to a command which is not recognized or is otherwise invalid in this context.

§

InstCmdFailed

Server failed to deliver the instant command request to the driver. No further information is available to the client.

§

SetFailed

Server failed to deliver the set request to the driver.

§

ReadOnly

The requested variable in a SET command is not writable.

§

TooLong

The requested value in a SET command is too long.

§

FeatureNotSupported

The server does not support the requested feature.

§

AlreadySslMode

TLS/SSL mode is already enabled on this connection, so the server can’t start it again.

§

DriverNotConnected

The server can’t perform the requested command, since the driver for that UPS is not connected.

§

DataStale

Server is connected to the driver for the UPS, but that driver isn’t providing regular updates or has specifically marked the data as stale.

§

AlreadyLoggedIn

The client already sent LOGIN for a UPS and can’t do it again. There is presently a limit of one LOGIN record per connection.

§

InvalidPassword

The client sent an invalid PASSWORD - perhaps an empty one.

§

AlreadySetPassword

The client already set a PASSWORD and can’t set another.

§

InvalidUsername

The client sent an invalid USERNAME.

§

AlreadySetUsername

The client has already set a USERNAME, and can’t set another.

§

UsernameRequired

The requested command requires a username for authentication, but the client hasn’t set one.

§

PasswordRequired

The requested command requires a password for authentication, but the client hasn’t set one.

§

UnknownCommand

The server doesn’t recognize the requested command.

§

InvalidValue

The value specified in the request is not valid.

§

UnexpectedResponse

Occurs when the response type or content wasn’t expected at the current stage.

§

UnknownResponseType(String)

Occurs when the response type is not recognized by the client.

§

SslNotSupported

Occurs when attempting to use SSL in a transport that doesn’t support it, or if the server is not configured for it.

§

SslInvalidHostname

Occurs when trying to initialize a strict SSL connection with an invalid hostname.

§

FeatureNotConfigured

Occurs when the client used a feature that is disabled by the server.

§

Generic(String)

Generic (usually internal) client error.

Implementations§

Source§

impl NutError

Source

pub fn generic<T: ToString>(message: T) -> Self

Constructs a generic rups error.

Trait Implementations§

Source§

impl Debug for NutError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for NutError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for NutError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<NutError> for ClientError

Source§

fn from(err: NutError) -> Self

Converts to this type from the input type.
Source§

impl<T: AsRef<ClientSentences>> From<T> for NutError

Source§

fn from(sentence: T) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.