insert_attribute panic with full message (#5651)

# Objective

When an invalid attribute is inserted and the LogPlugin is not enabled the full error is not printed which means makes it hard to diagnose.

## Solution

- Always print the full message in the panic.

## Notes

I originally had a separate error log because I wanted to make it clearer for users, but this is probably causing more issues than necessary.
This commit is contained in:
Charles 2022-08-15 22:17:41 +00:00
parent f1be89d458
commit 5ba5c8e375

View File

@ -110,15 +110,13 @@ impl Mesh {
attribute: MeshVertexAttribute, attribute: MeshVertexAttribute,
values: impl Into<VertexAttributeValues>, values: impl Into<VertexAttributeValues>,
) { ) {
let values: VertexAttributeValues = values.into(); let values = values.into();
let values_format = VertexFormat::from(&values); let values_format = VertexFormat::from(&values);
if values_format != attribute.format { if values_format != attribute.format {
error!( panic!(
"Invalid attribute format for {}. Given format is {:?} but expected {:?}", "Failed to insert attribute. Invalid attribute format for {}. Given format is {:?} but expected {:?}",
attribute.name, values_format, attribute.format attribute.name, values_format, attribute.format
); );
panic!("Failed to insert attribute");
} }
self.attributes self.attributes