mirror of
https://github.com/chatmail/core.git
synced 2026-05-04 22:06:29 +03:00
Convert BlobError into an enum
This deletes a lot of code and complexity. Though comes at some cost: - The type no longer fits in a register and will always be on the stack. - Constructing the errors is more verbose, no more auto Into casting.
This commit is contained in:
committed by
Floris Bruynooghe
parent
084a87ed61
commit
74a4691f29
@@ -5,7 +5,7 @@ use std::path::{Path, PathBuf};
|
||||
use itertools::Itertools;
|
||||
use num_traits::FromPrimitive;
|
||||
|
||||
use crate::blob::{BlobErrorKind, BlobObject};
|
||||
use crate::blob::{BlobError, BlobObject};
|
||||
use crate::chatlist::*;
|
||||
use crate::config::*;
|
||||
use crate::constants::*;
|
||||
@@ -1797,8 +1797,8 @@ pub fn set_chat_profile_image(
|
||||
));
|
||||
} else {
|
||||
let image_blob = BlobObject::from_path(context, Path::new(new_image.as_ref())).or_else(
|
||||
|err| match err.kind() {
|
||||
BlobErrorKind::WrongBlobdir => {
|
||||
|err| match err {
|
||||
BlobError::WrongBlobdir { .. } => {
|
||||
BlobObject::create_and_copy(context, Path::new(new_image.as_ref()))
|
||||
}
|
||||
_ => Err(err),
|
||||
|
||||
Reference in New Issue
Block a user