From 5ba5c8e375bd0271e2bf50728a85a1691ec8666b Mon Sep 17 00:00:00 2001 From: Charles Date: Mon, 15 Aug 2022 22:17:41 +0000 Subject: [PATCH] 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. --- crates/bevy_render/src/mesh/mesh/mod.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/crates/bevy_render/src/mesh/mesh/mod.rs b/crates/bevy_render/src/mesh/mesh/mod.rs index 8f391714d7f26..88a0ef1bc2659 100644 --- a/crates/bevy_render/src/mesh/mesh/mod.rs +++ b/crates/bevy_render/src/mesh/mesh/mod.rs @@ -110,15 +110,13 @@ impl Mesh { attribute: MeshVertexAttribute, values: impl Into, ) { - 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