aboutsummaryrefslogtreecommitdiff
path: root/azalea-nbt/src/error.rs
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-05-26 17:55:07 -0500
committermat <github@matdoes.dev>2022-05-26 17:55:07 -0500
commit0530c5757925c615d0529926b1550da05f0669d9 (patch)
tree24b40c461a8117dee019c8941e205f375e3a3c21 /azalea-nbt/src/error.rs
parent1e145a82b80fb0402e8a64624454d9bfee77bc72 (diff)
downloadazalea-drasl-0530c5757925c615d0529926b1550da05f0669d9.tar.xz
Fixes
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)
}
}