Skip to content

Commit

Permalink
rune: Never error in Value debug formatting
Browse files Browse the repository at this point in the history
Instead attempt to print *something*
  • Loading branch information
VorpalBlade committed Jul 17, 2024
1 parent 952b5fb commit 4626a56
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion crates/rune/src/runtime/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2035,7 +2035,15 @@ impl fmt::Debug for Value {
let mut o = Formatter::new();

if value.string_debug(&mut o).is_err() {
return Err(fmt::Error);
match value.type_info() {
VmResult::Ok(type_info) => {
write!(f, "<{} object at {:p}>", type_info, value)?;
}
VmResult::Err(_) => {
write!(f, "<unknown object at {:p}>", value)?;
}
}
return Ok(());
}

f.write_str(o.as_str())?;
Expand Down

0 comments on commit 4626a56

Please sign in to comment.