diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2022-08-06 07:22:19 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-06 02:22:19 -0500 |
| commit | 5a9fca0ca9cdb46f4b866781f219756c89e2293a (patch) | |
| tree | b006e28b91a181734fb9702bb6ec510f5b2af3df /azalea-core/src/difficulty.rs | |
| parent | 1d48c3fe34edd4e2295f54bd3d79f81f58c38a8e (diff) | |
| download | azalea-drasl-5a9fca0ca9cdb46f4b866781f219756c89e2293a.tar.xz | |
Better errors (#14)
* make reading use thiserror
* finish implementing all the error things
* clippy warnings related to ok_or
* fix some errors in other places
* thiserror in more places
* don't use closures in a couple places
* errors in writing packet
* rip backtraces
* change some BufReadError::Custom to UnexpectedEnumVariant
* Errors say what packet is bad
* error on leftover data and fix
it wasn't reading the properties for gameprofile
Diffstat (limited to 'azalea-core/src/difficulty.rs')
| -rwxr-xr-x | azalea-core/src/difficulty.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/azalea-core/src/difficulty.rs b/azalea-core/src/difficulty.rs index f2877f79..65950e8d 100755 --- a/azalea-core/src/difficulty.rs +++ b/azalea-core/src/difficulty.rs @@ -3,7 +3,7 @@ use std::{ io::{Read, Write}, }; -use azalea_buf::{McBufReadable, McBufWritable}; +use azalea_buf::{BufReadError, McBufReadable, McBufWritable}; #[derive(Hash, Clone, Debug, PartialEq, Eq)] pub enum Difficulty { @@ -67,7 +67,7 @@ impl Difficulty { } impl McBufReadable for Difficulty { - fn read_from(buf: &mut impl Read) -> Result<Self, String> { + fn read_from(buf: &mut impl Read) -> Result<Self, BufReadError> { Ok(Difficulty::by_id(u8::read_from(buf)?)) } } |
