0
0
Fork 0
mirror of https://git.verdigado.com/NB-Public/simple-wkd.git synced 2024-12-06 14:52:41 +01:00

Improve error handling

This commit is contained in:
Delta1925 2023-04-13 23:32:12 +02:00
parent 4b445a6a96
commit 98f0563952
No known key found for this signature in database
GPG key ID: 1C21ACE44193CB25
4 changed files with 17 additions and 19 deletions

View file

@ -32,7 +32,7 @@ pub fn get_email_from_cert(cert: &Cert) -> Result<String, Error> {
};
let email_opt = match userid_opt.email() {
Ok(email_opt) => email_opt,
Err(_) => return Err(Error::ParseMail),
Err(_) => return Err(Error::ParseCert),
};
match email_opt {
Some(email) => Ok(email),
@ -43,11 +43,11 @@ pub fn get_email_from_cert(cert: &Cert) -> Result<String, Error> {
pub fn get_user_file_path(email: &str) -> Result<PathBuf, Error> {
let wkd_url = match Url::from(email) {
Ok(wkd_url) => wkd_url,
Err(_) => return Err(Error::ParseMail),
Err(_) => return Err(Error::PathGeneration),
};
match wkd_url.to_file_path(VARIANT) {
Ok(path) => Ok(path),
Err(_) => Err(Error::ParseMail),
Err(_) => Err(Error::PathGeneration),
}
}