From 1dbb3d97eb1c728e58fcdbed3504b13a4b62c2dc Mon Sep 17 00:00:00 2001 From: Mike Aizatsky Date: Wed, 14 Aug 2024 07:30:55 -0700 Subject: [PATCH] more user-friendly jsg exception message Strictly speaking this is not backward compatible, but I doubt anyone cares and it has saved me some time while debugging an issue. --- src/workerd/jsg/struct.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/workerd/jsg/struct.h b/src/workerd/jsg/struct.h index 31482bb470b..fc6c4a56191 100644 --- a/src/workerd/jsg/struct.h +++ b/src/workerd/jsg/struct.h @@ -103,8 +103,9 @@ class StructWrapper, kj::_::Indexes()) && ...)) { return T{}; } - jsg::throwTypeError(isolate, "Cannot initialize a dictionary with required members from an " - "undefined or null value."); + jsg::throwTypeError(isolate, kj::str("Cannot initialize ", typeid(T).name(), + " with required members from an " + "undefined or null value.")); } if (!handle->IsObject()) return kj::none;