diff --git a/CHANGELOG.md b/CHANGELOG.md index 1de02589d..f0fb248e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ You can find its changes [documented below](#083---2023-02-28). ### Added +- Type name is now included in panic error messages in `WidgetPod`. ([#2380] by [@matthewgapp]) + ### Changed ### Deprecated @@ -787,6 +789,7 @@ Last release without a changelog :( [@newcomb-luke]: https://github.com/newcomb-luke [@AtomicGamer9523]: https://github.com/AtomicGamer9523 [@Insprill]: https://github.com/Insprill +[@matthewgapp]: https://github.com/matthewgapp [#599]: https://github.com/linebender/druid/pull/599 [#611]: https://github.com/linebender/druid/pull/611 @@ -1233,6 +1236,7 @@ Last release without a changelog :( [#2356]: https://github.com/linebender/druid/pull/2356 [#2375]: https://github.com/linebender/druid/pull/2375 [#2378]: https://github.com/linebender/druid/pull/2378 +[#2380]: https://github.com/linebender/druid/pull/2380 [Unreleased]: https://github.com/linebender/druid/compare/v0.8.3...master [0.8.3]: https://github.com/linebender/druid/compare/v0.8.2...v0.8.3 diff --git a/druid/src/core.rs b/druid/src/core.rs index db2ec7314..ec922dc8e 100644 --- a/druid/src/core.rs +++ b/druid/src/core.rs @@ -475,7 +475,8 @@ impl> WidgetPod { if !self.is_initialized() { debug_panic!( - "{:?}: paint method called before receiving WidgetAdded.", + "{:?} with widget id {:?}: paint method called before receiving WidgetAdded.", + self.inner.type_name(), ctx.widget_id() ); return; @@ -549,7 +550,8 @@ impl> WidgetPod { ) -> Size { if !self.is_initialized() { debug_panic!( - "{:?}: layout method called before receiving WidgetAdded.", + "{:?} with widget id {:?}: layout method called before receiving WidgetAdded.", + self.inner.type_name(), ctx.widget_id() ); return Size::ZERO; @@ -608,7 +610,8 @@ impl> WidgetPod { pub fn event(&mut self, ctx: &mut EventCtx, event: &Event, data: &mut T, env: &Env) { if !self.is_initialized() { debug_panic!( - "{:?}: event method called before receiving WidgetAdded.", + "{:?} with widget id {:?}: event method called before receiving WidgetAdded.", + self.inner.type_name(), ctx.widget_id() ); return; @@ -617,8 +620,9 @@ impl> WidgetPod { // log if we seem not to be laid out when we should be if self.state.is_expecting_set_origin_call && !event.should_propagate_to_hidden() { warn!( - "{:?} received an event ({:?}) without having been laid out. \ + "{:?} with widget id {:?} received an event ({:?}) without having been laid out. \ This likely indicates a missed call to set_origin.", + self.inner.type_name(), ctx.widget_id(), event, ); @@ -1015,7 +1019,8 @@ impl> WidgetPod { } _ if !self.is_initialized() => { debug_panic!( - "{:?}: received LifeCycle::{:?} before WidgetAdded.", + "{:?} with widget id {:?}: received LifeCycle::{:?} before WidgetAdded.", + self.inner.type_name(), self.id(), event ); @@ -1149,7 +1154,8 @@ impl> WidgetPod { (Some(_), None) => self.env = Some(env.clone()), (None, _) => { debug_panic!( - "{:?} is receiving an update without having first received WidgetAdded.", + "{:?} with widget id {:?} is receiving an update without having first received WidgetAdded.", + self.inner.type_name(), self.id() ); return;