diff options
author | Lars Wirzenius <liw@liw.fi> | 2023-01-07 10:25:42 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2023-01-07 10:25:42 +0200 |
commit | 9af47a69adecc531e6791ead83ae7f32eef7cc20 (patch) | |
tree | caea4424199095f9cdaaf71f4840ef07faa89218 | |
parent | d48c4f0c71b9fdd8aa28367be11d56cfa63b6afc (diff) | |
download | riki-9af47a69adecc531e6791ead83ae7f32eef7cc20.tar.gz |
refactor: move SiteError::Utf8 into src.page.rs
Sponsored-by: author
-rw-r--r-- | src/error.rs | 3 | ||||
-rw-r--r-- | src/page.rs | 5 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/error.rs b/src/error.rs index 3053ca8..74970f7 100644 --- a/src/error.rs +++ b/src/error.rs @@ -18,9 +18,6 @@ pub enum SiteError { #[error("string formatting error: {0}")] Format(#[source] std::fmt::Error), - #[error("could not convert input text from {0} to UTF-8")] - Utf8(PathBuf, #[source] std::string::FromUtf8Error), - #[error("failed to compute relative path for {0} against {1}")] Relative(PathBuf, PathBuf), diff --git a/src/page.rs b/src/page.rs index 4a9930c..3dd3029 100644 --- a/src/page.rs +++ b/src/page.rs @@ -14,6 +14,9 @@ use std::time::SystemTime; pub enum PageError { #[error("could not read file: {0}")] FileRead(PathBuf, #[source] std::io::Error), + + #[error("could not convert input text from {0} to UTF-8")] + Utf8(PathBuf, #[source] std::string::FromUtf8Error), } pub struct Page { @@ -51,7 +54,7 @@ impl WikitextPage { let src = name.source_path(); let data = std::fs::read(src).map_err(|e| PageError::FileRead(src.into(), e))?; - let wikitext = String::from_utf8(data).map_err(|e| SiteError::Utf8(src.into(), e))?; + let wikitext = String::from_utf8(data).map_err(|e| PageError::Utf8(src.into(), e))?; let mtime = get_mtime(src)?; let meta = MetaBuilder::default() |