use std::fmt::{Display, Formatter};
use crate::TheErrorType;
#[derive(Debug, Default)]
#[allow(dead_code)]
pub enum SystemErrorCodes {
BadDateFormat,
BadCompressedPacketHeader,
BorrowError,
CantParseServerVersion,
ChannelError,
CleartextPluginDisabled,
ConnectionClosed,
ConnectionError,
ConnectionRefused,
ConversionError,
DbConnectionError,
DbConnectionTimedOut,
Deadlock,
DecodeError,
Empty,
#[default]
Error,
EnvironmentError,
FeatureRequired,
FormatError,
FromRow,
FromValue,
GenericError,
HandleError,
HostUnreachable,
HttpRequestError,
HttpResponseError,
InitializeError,
Invalid,
InvalidDateValue,
InvalidData,
InvalidFilename,
InvalidFilepath,
InvalidInput,
InvalidParamValue,
InvalidPoolConstraints,
Io,
JoinError,
JsonError,
LayoutError,
LocalInfile,
LockError,
MemoryError,
MissingNamedParam,
MixedParams,
MutexError,
MysqlOldPasswordDisabled,
NamedParamsForPositionalQuery,
NamedPipesDisabled,
NestedTransaction,
NoClientSslFlagFromServer,
NoKeyFound,
NotConnected,
NotFound,
Other,
OutOfRange,
OutOfRangeDateValue,
Overflow,
PacketOutOfOrder,
PacketTooLarge,
ParseError,
PermissionDenied,
PoolDisconnected,
ReadOnlyTransNotSupported,
ReadWriteError,
ResourceBusy,
SemaphoreError,
ServerError,
SerializationError,
SocketError,
SyncError,
SlowConnection,
StmtParamsMismatch,
StorageFull,
SystemTimeError,
TaskError,
ThreadError,
TimedOut,
TimerError,
Tls,
UnexpectedPacket,
UnknownAuthPlugin,
UnknownParameter,
Unsupported,
UrlError,
Zero
}
impl Display for SystemErrorCodes {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}", self)
}
}
impl From<SystemErrorCodes> for TheErrorType {
fn from(error: SystemErrorCodes) -> Self {
TheErrorType {
error_content: error.to_string(),
error_type: error,
}
}
}