Skip to main content

Error

Enum Error 

Source
#[non_exhaustive]
pub enum Error {
Show 29 variants NoRoom {}, RanOut {}, BadString, BadName, BadKex, BadDecrypt, BadSig, BadNumber, SSHProto {}, SSHProtoUnsupported, BadKeyFormat, NotSSH, BadKey, NoChannels, BadChannel { num: ChanNum, }, BadChannelData, BadUsage {}, WrongPacketLength, ChannelEOF, SessionEOF, NotAvailable { what: &'static str, }, UnknownPacket { number: u8, }, PacketWrong {}, AlgoNoMatch { algo: &'static str, }, BigPacket { size: usize, }, NoAuthMethods, UnknownMethod { kind: &'static str, }, Custom { msg: &'static str, }, Bug,
}
Expand description

The Sunset error type.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

NoRoom

Output buffer ran out of room

§

RanOut

Input buffer ran out

§

BadString

Not a UTF-8 string

§

BadName

Not a valid SSH ASCII string

§

BadKex

Key exchange incorrect

§

BadDecrypt

Packet integrity failed

§

BadSig

Signature is incorrect

§

BadNumber

Integer overflow in packet

§

SSHProto

Error in received SSH protocol. Will disconnect.

§

SSHProtoUnsupported

Peer sent something we don’t handle. Will disconnect.

This differs to SSHProtoError. In this case the peer may be behaved within the SSH specifications, but Sunset doesn’t support it.

§

BadKeyFormat

Received a key with invalid structure, or too large.

§

NotSSH

Remote peer isn’t SSH 2.0

§

BadKey

Bad key format

§

NoChannels

Ran out of channels

§

BadChannel

Fields

§

BadChannelData

Bad channel data type

Returned from an API call that would imply ChanData::Stderr being sent to a server. This error will not be returned for network data in the incorrect direction, instead that data is dropped.

§

BadUsage

Bad application usage

Returned from an API call when the API is used incorrectly. Examples could include:

  • A ChanHandle is used incorrectly, for example being cloned (millions of times) and not released.
§

WrongPacketLength

SSH packet contents doesn’t match length

§

ChannelEOF

Channel EOF

This is an expected error when a SSH channel completes. Can be returned by channel read/write functions. Any further calls in the same direction will fail similarly.

§

SessionEOF

Session EOF

This is an expected error when the SSH session has finished.

§

NotAvailable

Fields

§what: &'static str
§

UnknownPacket

Fields

§number: u8
§

PacketWrong

Received packet at a disallowed time.

§

AlgoNoMatch

Fields

§algo: &'static str
§

BigPacket

Fields

§size: usize
§

NoAuthMethods

Ran out of authentication methods to try (as a client)

§

UnknownMethod

An unknown SSH name is provided, for a key type, signature type, channel name etc.

Fields

§kind: &'static str
§

Custom

Fields

§msg: &'static str
§

Bug

Program bug

Implementations§

Source§

impl Error

Source

pub fn msg(m: &'static str) -> Error

Source

pub fn bug() -> Error

Panics in debug builds, returns Error::Bug in release.

Source

pub fn bug_fmt(args: Arguments<'_>) -> Error

Like bug() but with a message

The message can be used instead of a code comment, is logged at trace level.

Source

pub fn bug_msg<T>(msg: &str) -> Result<T, Error>

TODO: is the generic T going to make it bloat?

Source

pub fn bug_err_msg(msg: &str) -> Error

Trait Implementations§

Source§

impl Debug for Error

Source§

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

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

impl Display for Error

Source§

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

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

impl Error for Error
where Self: Debug + Display,

Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

Source§

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

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

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

Source§

impl ErrorCompat for Error

Source§

fn backtrace(&self) -> Option<&Backtrace>

Returns a Backtrace that may be printed.
Source§

fn iter_chain(&self) -> ChainCompat<'_, '_>
where Self: AsErrorSource,

Returns an iterator for traversing the chain of errors, starting with the current error and continuing with recursive calls to Error::source. Read more
Source§

impl From<Utf8Error> for Error

Source§

fn from(_e: Utf8Error) -> Error

Converts to this type from the input type.
Source§

impl From<WireError> for Error

Source§

fn from(w: WireError) -> Self

Converts to this type from the input type.
Source§

impl IntoError<Error> for NoRoom

Source§

type Source = NoneError

The underlying error
Source§

fn into_error(self, error: Self::Source) -> Error

Combine the information to produce the error
Source§

impl IntoError<Error> for RanOut

Source§

type Source = NoneError

The underlying error
Source§

fn into_error(self, error: Self::Source) -> Error

Combine the information to produce the error
Source§

impl IntoError<Error> for BadString

Source§

type Source = NoneError

The underlying error
Source§

fn into_error(self, error: Self::Source) -> Error

Combine the information to produce the error
Source§

impl IntoError<Error> for BadName

Source§

type Source = NoneError

The underlying error
Source§

fn into_error(self, error: Self::Source) -> Error

Combine the information to produce the error
Source§

impl IntoError<Error> for BadKex

Source§

type Source = NoneError

The underlying error
Source§

fn into_error(self, error: Self::Source) -> Error

Combine the information to produce the error
Source§

impl IntoError<Error> for BadDecrypt

Source§

type Source = NoneError

The underlying error
Source§

fn into_error(self, error: Self::Source) -> Error

Combine the information to produce the error
Source§

impl IntoError<Error> for BadSig

Source§

type Source = NoneError

The underlying error
Source§

fn into_error(self, error: Self::Source) -> Error

Combine the information to produce the error
Source§

impl IntoError<Error> for BadNumber

Source§

type Source = NoneError

The underlying error
Source§

fn into_error(self, error: Self::Source) -> Error

Combine the information to produce the error
Source§

impl IntoError<Error> for SSHProto

Source§

type Source = NoneError

The underlying error
Source§

fn into_error(self, error: Self::Source) -> Error

Combine the information to produce the error
Source§

impl IntoError<Error> for SSHProtoUnsupported

Source§

type Source = NoneError

The underlying error
Source§

fn into_error(self, error: Self::Source) -> Error

Combine the information to produce the error
Source§

impl IntoError<Error> for BadKeyFormat

Source§

type Source = NoneError

The underlying error
Source§

fn into_error(self, error: Self::Source) -> Error

Combine the information to produce the error
Source§

impl IntoError<Error> for NotSSH

Source§

type Source = NoneError

The underlying error
Source§

fn into_error(self, error: Self::Source) -> Error

Combine the information to produce the error
Source§

impl IntoError<Error> for BadKey

Source§

type Source = NoneError

The underlying error
Source§

fn into_error(self, error: Self::Source) -> Error

Combine the information to produce the error
Source§

impl IntoError<Error> for NoChannels

Source§

type Source = NoneError

The underlying error
Source§

fn into_error(self, error: Self::Source) -> Error

Combine the information to produce the error
Source§

impl<__T0> IntoError<Error> for BadChannel<__T0>
where Error: Error + ErrorCompat, __T0: Into<ChanNum>,

Source§

type Source = NoneError

The underlying error
Source§

fn into_error(self, error: Self::Source) -> Error

Combine the information to produce the error
Source§

impl IntoError<Error> for BadChannelData

Source§

type Source = NoneError

The underlying error
Source§

fn into_error(self, error: Self::Source) -> Error

Combine the information to produce the error
Source§

impl IntoError<Error> for BadUsage

Source§

type Source = NoneError

The underlying error
Source§

fn into_error(self, error: Self::Source) -> Error

Combine the information to produce the error
Source§

impl IntoError<Error> for WrongPacketLength

Source§

type Source = NoneError

The underlying error
Source§

fn into_error(self, error: Self::Source) -> Error

Combine the information to produce the error
Source§

impl IntoError<Error> for ChannelEOF

Source§

type Source = NoneError

The underlying error
Source§

fn into_error(self, error: Self::Source) -> Error

Combine the information to produce the error
Source§

impl IntoError<Error> for SessionEOF

Source§

type Source = NoneError

The underlying error
Source§

fn into_error(self, error: Self::Source) -> Error

Combine the information to produce the error
Source§

impl<__T0> IntoError<Error> for NotAvailable<__T0>
where Error: Error + ErrorCompat, __T0: Into<&'static str>,

Source§

type Source = NoneError

The underlying error
Source§

fn into_error(self, error: Self::Source) -> Error

Combine the information to produce the error
Source§

impl<__T0> IntoError<Error> for UnknownPacket<__T0>
where Error: Error + ErrorCompat, __T0: Into<u8>,

Source§

type Source = NoneError

The underlying error
Source§

fn into_error(self, error: Self::Source) -> Error

Combine the information to produce the error
Source§

impl IntoError<Error> for PacketWrong

Source§

type Source = NoneError

The underlying error
Source§

fn into_error(self, error: Self::Source) -> Error

Combine the information to produce the error
Source§

impl<__T0> IntoError<Error> for AlgoNoMatch<__T0>
where Error: Error + ErrorCompat, __T0: Into<&'static str>,

Source§

type Source = NoneError

The underlying error
Source§

fn into_error(self, error: Self::Source) -> Error

Combine the information to produce the error
Source§

impl<__T0> IntoError<Error> for BigPacket<__T0>
where Error: Error + ErrorCompat, __T0: Into<usize>,

Source§

type Source = NoneError

The underlying error
Source§

fn into_error(self, error: Self::Source) -> Error

Combine the information to produce the error
Source§

impl IntoError<Error> for NoAuthMethods

Source§

type Source = NoneError

The underlying error
Source§

fn into_error(self, error: Self::Source) -> Error

Combine the information to produce the error
Source§

impl<__T0> IntoError<Error> for UnknownMethod<__T0>
where Error: Error + ErrorCompat, __T0: Into<&'static str>,

Source§

type Source = NoneError

The underlying error
Source§

fn into_error(self, error: Self::Source) -> Error

Combine the information to produce the error
Source§

impl<__T0> IntoError<Error> for Custom<__T0>
where Error: Error + ErrorCompat, __T0: Into<&'static str>,

Source§

type Source = NoneError

The underlying error
Source§

fn into_error(self, error: Self::Source) -> Error

Combine the information to produce the error
Source§

impl IntoError<Error> for Bug

Source§

type Source = NoneError

The underlying error
Source§

fn into_error(self, error: Self::Source) -> Error

Combine the information to produce the error

Auto Trait Implementations§

§

impl Freeze for Error

§

impl RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

§

impl UnwindSafe for Error

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> AsErrorSource for T
where T: Error + 'static,

Source§

fn as_error_source(&self) -> &(dyn Error + 'static)

For maximum effectiveness, this needs to be called as a method to benefit from Rust’s automatic dereferencing of method receivers.
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> Same for T

Source§

type Output = T

Should always be Self
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.