aboutsummaryrefslogtreecommitdiffstats
path: root/src/tokenizer.rs
diff options
context:
space:
mode:
authorGustav Sörnäs <gustav@sornas.net>2021-03-10 18:44:59 +0100
committerGustav Sörnäs <gustav@sornas.net>2021-03-10 18:44:59 +0100
commit0275d67aba60706ed6c1311af615e97653c751dc (patch)
treeb0085d348b517b41aa8cfe2ec04c7cd27eaec611 /src/tokenizer.rs
parent21b76633d149f62dbfdf55702dbdf8c84bf14105 (diff)
downloadsylt-main.tar.gz
handle file not founds everywheremain
Diffstat (limited to 'src/tokenizer.rs')
-rw-r--r--src/tokenizer.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/tokenizer.rs b/src/tokenizer.rs
index 8b06324..2203a6e 100644
--- a/src/tokenizer.rs
+++ b/src/tokenizer.rs
@@ -183,8 +183,8 @@ pub fn string_to_tokens(content: &str) -> TokenStream {
lined_tokens
}
-pub fn file_to_tokens(file: &Path) -> TokenStream {
- string_to_tokens(&fs::read_to_string(file).unwrap())
+pub fn file_to_tokens(file: &Path) -> Result<TokenStream, std::io::Error> {
+ Ok(string_to_tokens(&fs::read_to_string(file)?))
}
#[cfg(test)]