diff options
| author | Federico Igne <git@federicoigne.com> | 2022-12-30 15:36:23 +0000 |
|---|---|---|
| committer | Federico Igne <git@federicoigne.com> | 2022-12-30 15:36:23 +0000 |
| commit | 481b08d9297e16e7c8eb29defc1a8b3302b937e5 (patch) | |
| tree | d7751e6142635ec0cd5f06b267ef39b54eb12f00 /src | |
| parent | a39e120e3fa6723c7ad8c4d27afca79233947935 (diff) | |
| download | pangler-481b08d9297e16e7c8eb29defc1a8b3302b937e5.tar.gz pangler-481b08d9297e16e7c8eb29defc1a8b3302b937e5.zip | |
qol: print name of missing macro on panic
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs index 8168ad8..1d6bdd4 100644 --- a/src/main.rs +++ b/src/main.rs | |||
| @@ -70,7 +70,7 @@ fn build( | |||
| 70 | if current_depth < max_depth { | 70 | if current_depth < max_depth { |
| 71 | let block = blocks | 71 | let block = blocks |
| 72 | .get(&Key::Macro(caps[2].to_string())) | 72 | .get(&Key::Macro(caps[2].to_string())) |
| 73 | .expect("Block not present") | 73 | .unwrap_or_else(|| panic!("Block \"{}\" not present", caps[2].to_string())) |
| 74 | .clone(); | 74 | .clone(); |
| 75 | indent(block, caps[1].len()) | 75 | indent(block, caps[1].len()) |
| 76 | } else { | 76 | } else { |
| @@ -88,8 +88,7 @@ fn build( | |||
| 88 | .clone() | 88 | .clone() |
| 89 | .unwrap_or(PathBuf::from(BASE)) | 89 | .unwrap_or(PathBuf::from(BASE)) |
| 90 | .join(path); | 90 | .join(path); |
| 91 | write_to_file(file, &code) | 91 | write_to_file(file, &code).unwrap(); |
| 92 | .expect("Unable to write to file"); | ||
| 93 | }) | 92 | }) |
| 94 | } | 93 | } |
| 95 | 94 | ||
