aboutsummaryrefslogtreecommitdiff
path: root/azalea-nbt/src/error.rs
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2022-06-08 23:37:54 +0000
committerGitHub <noreply@github.com>2022-06-08 23:37:54 +0000
commit601637bd48fcba826da01725430268f706181449 (patch)
tree5b58723b931450d358d7e4387d87cc8e8b9166b2 /azalea-nbt/src/error.rs
parentea7249fb77a8e07d232600081c9c3df5f698d70f (diff)
parentfb1d419a3d4207a293a1ad6001253192f1b4d12f (diff)
downloadazalea-drasl-601637bd48fcba826da01725430268f706181449.tar.xz
Merge pull request #7 from mat-1/1.19
1.19
Diffstat (limited to 'azalea-nbt/src/error.rs')
-rwxr-xr-xazalea-nbt/src/error.rs14
1 files changed, 8 insertions, 6 deletions
diff --git a/azalea-nbt/src/error.rs b/azalea-nbt/src/error.rs
index 219921e4..ef4a9e9f 100755
--- a/azalea-nbt/src/error.rs
+++ b/azalea-nbt/src/error.rs
@@ -2,7 +2,8 @@
pub enum Error {
InvalidTagType(u8),
InvalidTag,
- WriteError,
+ WriteError(std::io::Error),
+ Utf8Error(std::string::FromUtf8Error),
}
impl std::fmt::Display for Error {
@@ -10,18 +11,19 @@ impl std::fmt::Display for Error {
match self {
Error::InvalidTagType(id) => write!(f, "Invalid tag type: {}", id),
Error::InvalidTag => write!(f, "Invalid tag"),
- Error::WriteError => write!(f, "Write error"),
+ Error::WriteError(e) => write!(f, "Write error: {}", e),
+ Error::Utf8Error(e) => write!(f, "Utf8 error: {}", e),
}
}
}
impl From<std::io::Error> for Error {
- fn from(_: std::io::Error) -> Self {
- Error::WriteError
+ fn from(e: std::io::Error) -> Self {
+ Error::WriteError(e)
}
}
impl From<std::string::FromUtf8Error> for Error {
- fn from(_: std::string::FromUtf8Error) -> Self {
- Error::WriteError
+ fn from(e: std::string::FromUtf8Error) -> Self {
+ Error::Utf8Error(e)
}
}