Skip to content

Commit d7809c1

Browse files
committed
fix: boxing the websiteerror because it's different size on windows
1 parent 5da0dbf commit d7809c1

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/site/media_library.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl MediaLibrary {
4747
let content = fs::read_to_string(&file_path)
4848
.map_err(|e| MediaLibraryError::Io(file_path.clone(), e))?;
4949
let meta_file: MetaMediaFile = toml::from_str(&content)
50-
.map_err(|e| MediaLibraryError::Parse(file_path.clone(), e))?;
50+
.map_err(|e| MediaLibraryError::Parse(file_path.clone(), Box::new(e)))?;
5151
Ok(Self {
5252
entries: meta_file.media,
5353
path: file_path,
@@ -207,7 +207,7 @@ fn extract_exif_date(path: &Path) -> Option<DateTime<Utc>> {
207207
#[derive(Debug)]
208208
pub enum MediaLibraryError {
209209
Io(PathBuf, io::Error),
210-
Parse(PathBuf, toml::de::Error),
210+
Parse(PathBuf, Box<toml::de::Error>),
211211
Serialize(toml::ser::Error),
212212
}
213213

src/site/website.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,8 @@ impl Website {
286286
pub enum WebsiteError {
287287
NotASite(PathBuf),
288288
NotAPath(PathBuf),
289-
Info(WebsiteInfoError),
290-
MediaLibrary(MediaLibraryError),
289+
Info(Box<WebsiteInfoError>),
290+
MediaLibrary(Box<MediaLibraryError>),
291291
Io(PathBuf, io::Error),
292292
Serialize(toml::ser::Error),
293293
Image(PathBuf, image::ImageError),
@@ -344,13 +344,13 @@ impl std::error::Error for WebsiteError {}
344344

345345
impl From<WebsiteInfoError> for WebsiteError {
346346
fn from(err: WebsiteInfoError) -> Self {
347-
WebsiteError::Info(err)
347+
WebsiteError::Info(Box::new(err))
348348
}
349349
}
350350

351351
impl From<MediaLibraryError> for WebsiteError {
352352
fn from(err: MediaLibraryError) -> Self {
353-
WebsiteError::MediaLibrary(err)
353+
WebsiteError::MediaLibrary(Box::new(err))
354354
}
355355
}
356356

src/site/website_info.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ impl WebsiteInfo {
3131
let file_path = path.join(SITE_TOML);
3232
let content = fs::read_to_string(&file_path)
3333
.map_err(|e| WebsiteInfoError::Io(file_path.clone(), e))?;
34-
let info: WebsiteInfo =
35-
toml::from_str(&content).map_err(|e| WebsiteInfoError::Parse(file_path, e))?;
34+
let info: WebsiteInfo = toml::from_str(&content)
35+
.map_err(|e| WebsiteInfoError::Parse(file_path, Box::new(e)))?;
3636
Ok(info)
3737
}
3838
}
@@ -42,7 +42,7 @@ impl WebsiteInfo {
4242
#[derive(Debug)]
4343
pub enum WebsiteInfoError {
4444
Io(PathBuf, io::Error),
45-
Parse(PathBuf, toml::de::Error),
45+
Parse(PathBuf, Box<toml::de::Error>),
4646
}
4747

4848
impl std::fmt::Display for WebsiteInfoError {

0 commit comments

Comments
 (0)