Add error for to nuon when closure block contents cannot be retrieved

This commit is contained in:
132ikl 2025-03-10 19:27:37 -04:00
parent c0abea584e
commit 8a60e7814a

View File

@ -105,7 +105,15 @@ fn value_to_string(
let contents_string = String::from_utf8_lossy(contents_bytes);
Ok(contents_string.to_string())
} else {
Ok(String::new())
return Err(ShellError::CantConvert {
to_type: "string".into(),
from_type: "closure".into(),
span,
help: Some(format!(
"unable to retrieve block contents for closure with id {}",
val.block_id.get()
)),
});
}
} else {
Err(ShellError::UnsupportedInput {