mirror of
https://github.com/YGGverse/ggemini.git
synced 2026-04-02 01:55:35 +00:00
fix status code error types
This commit is contained in:
parent
8f7bbaec76
commit
c2b06fd688
4 changed files with 5 additions and 3 deletions
|
|
@ -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),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
Decode,
|
Decode,
|
||||||
|
Protocol,
|
||||||
Undefined,
|
Undefined,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
Decode,
|
Decode,
|
||||||
|
Protocol,
|
||||||
Undefined,
|
Undefined,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue