aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenauxg <19689618+Henauxg@users.noreply.github.com>2022-11-18 15:49:21 +0100
committerHenauxg <19689618+Henauxg@users.noreply.github.com>2022-11-18 15:49:21 +0100
commita98498641df82547c9c05b35bab33377a356fe64 (patch)
tree8135cb5d0ef0fd30c79b5e1a6f81a8774e99eb99
parentf3be35ee7b63f8a33c627902766d235dd02d8ed0 (diff)
[shared] Add new error types
-rw-r--r--src/shared.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/shared.rs b/src/shared.rs
index 4722711..6a8f1a8 100644
--- a/src/shared.rs
+++ b/src/shared.rs
@@ -1,7 +1,8 @@
-use std::{fmt, sync::PoisonError};
+use std::{fmt, io, net::AddrParseError, sync::PoisonError};
use crate::client::ConnectionId;
use bevy::prelude::{Deref, DerefMut, Resource};
+use rcgen::RcgenError;
use tokio::runtime::Runtime;
pub const DEFAULT_MESSAGE_QUEUE_SIZE: usize = 150;
@@ -16,6 +17,10 @@ pub(crate) struct AsyncRuntime(pub(crate) Runtime);
/// Enum with possibles errors that can occur in Bevy Quinnet
#[derive(thiserror::Error, Debug)]
pub enum QuinnetError {
+ #[error("IP/Socket address is invalid")]
+ InvalidAddress(#[from] AddrParseError),
+ #[error("Failed to generate a self-signed certificate")]
+ CertificateGenerationFailed(#[from] RcgenError),
#[error("Client with id `{0}` is unknown")]
UnknownClient(ClientId),
#[error("Connection with id `{0}` is unknown")]
@@ -34,6 +39,10 @@ pub enum QuinnetError {
LockAcquisitionFailure,
#[error("A Certificate action was already sent for a CertificateInteractionEvent")]
CertificateActionAlreadyApplied,
+ #[error("Failed to read/write file(s)")]
+ IoError(#[from] io::Error),
+ #[error("Rustls protocol error")]
+ RustlsError(#[from] rustls::Error),
}
impl<T> From<PoisonError<T>> for QuinnetError {