From fb9a58e3af7ac4bbe919378b6228c78757de5844 Mon Sep 17 00:00:00 2001 From: Kris Kowal Date: Fri, 20 Sep 2024 11:56:56 -0700 Subject: [PATCH] refactor(ses): Improve permit exception messages --- packages/ses/src/permits-intrinsics.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/ses/src/permits-intrinsics.js b/packages/ses/src/permits-intrinsics.js index 03f7fe2250..fc13c61718 100644 --- a/packages/ses/src/permits-intrinsics.js +++ b/packages/ses/src/permits-intrinsics.js @@ -156,8 +156,10 @@ export default function whitelistIntrinsics( return; } - // We can't clean [[prototype]], therefore abort. - throw TypeError(`Unexpected intrinsic ${path}.__proto__ at ${protoName}`); + // We can't clean [[Prototype]], therefore abort. + throw TypeError( + `Unexpected [[Prototype]] at ${path}.__proto__ (expected ${protoName || '%ObjectPrototype%'})`, + ); } /* @@ -212,7 +214,9 @@ export default function whitelistIntrinsics( } } - throw TypeError(`Unexpected whitelist permit ${permit} at ${path}`); + throw TypeError( + `Unexpected property ${prop} with permit ${permit} at ${path}`, + ); } /*