panic for undefined variables

main
Elnu 2 years 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) { if let Some(value) = variables.get(var_name) {
value.to_string() value.to_string()
} else { } else {
format!("[{}]", var_name) panic!("undefined variable `{var_name}`");
} }
}); });

Loading…
Cancel
Save