Skip to content

Commit

Permalink
insert_attribute panic with full message (bevyengine#5651)
Browse files Browse the repository at this point in the history
# 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.
  • Loading branch information
IceSentry committed Aug 15, 2022
1 parent f1be89d commit 5ba5c8e
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions crates/bevy_render/src/mesh/mesh/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,13 @@ impl Mesh {
attribute: MeshVertexAttribute,
values: impl Into<VertexAttributeValues>,
) {
let values: VertexAttributeValues = values.into();

let values = values.into();
let values_format = VertexFormat::from(&values);
if values_format != attribute.format {
error!(
"Invalid attribute format for {}. Given format is {:?} but expected {:?}",
panic!(
"Failed to insert attribute. Invalid attribute format for {}. Given format is {:?} but expected {:?}",
attribute.name, values_format, attribute.format
);
panic!("Failed to insert attribute");
}

self.attributes
Expand Down

0 comments on commit 5ba5c8e

Please sign in to comment.