From bbde1c84ca5dc86f005680201f66256e07aae3b0 Mon Sep 17 00:00:00 2001 From: MultisampledNight Date: Sun, 21 Jan 2024 21:08:27 +0100 Subject: [PATCH] chore: move error handling todos from msgs into comments --- crates/app/src/main.rs | 10 ++++------ crates/eval/src/kind/debug/instr/mod.rs | 3 ++- crates/ir/src/semi_human.rs | 3 ++- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/crates/app/src/main.rs b/crates/app/src/main.rs index c523594..58103a5 100644 --- a/crates/app/src/main.rs +++ b/crates/app/src/main.rs @@ -10,18 +10,16 @@ mod error_reporting; mod welcome_msg; fn main() { - // TODO: proper error handling + // TODO: proper error handling across the whole function + // don't forget to also look inside `Config` let cfg = Config::read(); if cfg.startup_msg { print_startup_msg(); } - let source = - fs::read_to_string(cfg.source).expect("can't find source file lol handle me better please"); - - let ir = - ir::from_ron(&source).expect("aww failed to parse source to graph ir handle me better"); + let source = fs::read_to_string(cfg.source).expect("can't find source file"); + let ir = ir::from_ron(&source).expect("failed to parse source to graph ir"); let mut machine = cfg.evaluator.pick(); machine.feed(ir); diff --git a/crates/eval/src/kind/debug/instr/mod.rs b/crates/eval/src/kind/debug/instr/mod.rs index b78c7b5..14afac8 100644 --- a/crates/eval/src/kind/debug/instr/mod.rs +++ b/crates/eval/src/kind/debug/instr/mod.rs @@ -18,6 +18,7 @@ pub mod write { use ir::instruction::write::{TargetFormat, TargetType, Write}; pub fn write(Write { target, format }: Write, input_data: &DynamicImage) { + // TODO: actual error handling input_data .save_with_format( match target { @@ -28,7 +29,7 @@ pub mod write { TargetFormat::Png => ImageFormat::Png, }, ) - .expect("couldn't save file — come back later and handle me properly please uwu"); + .expect("couldn't save file"); } } diff --git a/crates/ir/src/semi_human.rs b/crates/ir/src/semi_human.rs index 7d7ff83..e8d3bdd 100644 --- a/crates/ir/src/semi_human.rs +++ b/crates/ir/src/semi_human.rs @@ -77,7 +77,8 @@ fn reverse_and_type_edges(edges: Map>) -> Map