chore: move error handling todos from msgs into comments
This commit is contained in:
parent
98f4a6cdeb
commit
bbde1c84ca
3 changed files with 8 additions and 8 deletions
|
@ -10,18 +10,16 @@ mod error_reporting;
|
||||||
mod welcome_msg;
|
mod welcome_msg;
|
||||||
|
|
||||||
fn main() {
|
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();
|
let cfg = Config::read();
|
||||||
|
|
||||||
if cfg.startup_msg {
|
if cfg.startup_msg {
|
||||||
print_startup_msg();
|
print_startup_msg();
|
||||||
}
|
}
|
||||||
|
|
||||||
let source =
|
let source = fs::read_to_string(cfg.source).expect("can't find source file");
|
||||||
fs::read_to_string(cfg.source).expect("can't find source file lol handle me better please");
|
let ir = ir::from_ron(&source).expect("failed to parse source to graph ir");
|
||||||
|
|
||||||
let ir =
|
|
||||||
ir::from_ron(&source).expect("aww failed to parse source to graph ir handle me better");
|
|
||||||
|
|
||||||
let mut machine = cfg.evaluator.pick();
|
let mut machine = cfg.evaluator.pick();
|
||||||
machine.feed(ir);
|
machine.feed(ir);
|
||||||
|
|
|
@ -18,6 +18,7 @@ pub mod write {
|
||||||
use ir::instruction::write::{TargetFormat, TargetType, Write};
|
use ir::instruction::write::{TargetFormat, TargetType, Write};
|
||||||
|
|
||||||
pub fn write(Write { target, format }: Write, input_data: &DynamicImage) {
|
pub fn write(Write { target, format }: Write, input_data: &DynamicImage) {
|
||||||
|
// TODO: actual error handling
|
||||||
input_data
|
input_data
|
||||||
.save_with_format(
|
.save_with_format(
|
||||||
match target {
|
match target {
|
||||||
|
@ -28,7 +29,7 @@ pub mod write {
|
||||||
TargetFormat::Png => ImageFormat::Png,
|
TargetFormat::Png => ImageFormat::Png,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.expect("couldn't save file — come back later and handle me properly please uwu");
|
.expect("couldn't save file");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,8 @@ fn reverse_and_type_edges(edges: Map<Socket, Set<Socket>>) -> Map<id::Input, id:
|
||||||
let input = id::Input(input.into());
|
let input = id::Input(input.into());
|
||||||
let previous = rev_edges.insert(input, output.clone());
|
let previous = rev_edges.insert(input, output.clone());
|
||||||
if let Some(previous) = previous {
|
if let Some(previous) = previous {
|
||||||
panic!("two or more outputs referred to the same input {previous:#?} — handle me better later with a TryFrom impl");
|
// TODO: handle this with a TryFrom impl
|
||||||
|
panic!("two or more outputs referred to the same input {previous:#?}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue