diff options
author | Henauxg <19689618+Henauxg@users.noreply.github.com> | 2022-11-09 16:36:25 +0100 |
---|---|---|
committer | Henauxg <19689618+Henauxg@users.noreply.github.com> | 2022-11-09 16:36:25 +0100 |
commit | ae8a6fc20637b971cb583ac87b12f455bc07e9f6 (patch) | |
tree | 4d8c4ea289e4407f4d8d32396ae1989b8dc4be8a /src/lib.rs | |
parent | 2991e10fcd3ae49865136b9c4dbed84eab8468cd (diff) |
Use thiserror in QuinnetError and return QuinnetErrors with serevr API
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -7,18 +7,19 @@ pub mod server; pub type ClientId = u64; -/// Enum with possibles errors that can occur. -#[derive(Debug)] +/// Enum with possibles errors that can occur in Bevy Quinnet +#[derive(thiserror::Error, Debug)] pub enum QuinnetError { - /// Failed serialization + #[error("Client with id `{0}` is unknown")] + UnknownClient(ClientId), + #[error("Failed serialization")] Serialization, - /// Failed deserialization + #[error("Failed deserialization")] Deserialization, - /// The data could not be sent on the channel because the channel is - /// currently full and sending would require blocking. + #[error("The data could not be sent on the channel because the channel is currently full and sending would require blocking")] FullQueue, - /// The receive half of the channel was explicitly closed or has been - /// dropped. + #[error("The receiving half of the channel was explicitly closed or has been dropped")] ChannelClosed, + #[error("The hosts file is invalid")] InvalidHostFile, } |