panic for undefined variables

main
Elnu 1 year ago
parent b882ef44c0
commit 9686884c62

@ -34,7 +34,7 @@ fn interpolate_string(input: &str, variables: &HashMap<String, Token>) -> String
if let Some(value) = variables.get(var_name) {
value.to_string()
} else {
format!("[{}]", var_name)
panic!("undefined variable `{var_name}`");
}
});

Loading…
Cancel
Save