fix status code error types

This commit is contained in:
yggverse 2024-10-30 04:35:04 +02:00
parent 8f7bbaec76
commit c2b06fd688
4 changed files with 5 additions and 3 deletions

View file

@ -16,14 +16,14 @@ impl Meta {
Some(value) => Ok(Self { Some(value) => Ok(Self {
buffer: value.to_vec(), buffer: value.to_vec(),
}), }),
None => return Err(Error::Undefined), None => return Err(Error::Protocol),
} }
} }
pub fn to_gstring(&self) -> Result<GString, Error> { pub fn to_gstring(&self) -> Result<GString, Error> {
match GString::from_utf8(self.buffer.clone()) { match GString::from_utf8(self.buffer.clone()) {
Ok(result) => Ok(result), Ok(result) => Ok(result),
Err(_) => Err(Error::Undefined), Err(_) => Err(Error::Decode),
} }
} }

View file

@ -1,5 +1,6 @@
#[derive(Debug)] #[derive(Debug)]
pub enum Error { pub enum Error {
Decode, Decode,
Protocol,
Undefined, Undefined,
} }

View file

@ -23,7 +23,7 @@ impl Status {
Ok(string) => Self::from_string(string.as_str()), Ok(string) => Self::from_string(string.as_str()),
Err(_) => Err(Error::Decode), Err(_) => Err(Error::Decode),
}, },
None => Err(Error::Undefined), None => Err(Error::Protocol),
} }
} }

View file

@ -1,5 +1,6 @@
#[derive(Debug)] #[derive(Debug)]
pub enum Error { pub enum Error {
Decode, Decode,
Protocol,
Undefined, Undefined,
} }