From 6c6c383cd86385030ee4bc162d1590063d68bc8b Mon Sep 17 00:00:00 2001 From: Jarda Snajdr Date: Sun, 6 Oct 2024 11:14:50 -0500 Subject: [PATCH] Private APIs: remove obsolete try/catch block --- packages/private-apis/src/implementation.js | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/packages/private-apis/src/implementation.js b/packages/private-apis/src/implementation.js index 13ee9873e899d..ab0ebfae7ecb0 100644 --- a/packages/private-apis/src/implementation.js +++ b/packages/private-apis/src/implementation.js @@ -59,18 +59,8 @@ const registeredPrivateApis = []; const requiredConsent = 'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.'; -/** @type {boolean} */ -let allowReRegistration; -// The safety measure is meant for WordPress core where IS_WORDPRESS_CORE -// is set to true. -// For the general use-case, the re-registration should be allowed by default -// Let's default to true, then. Try/catch will fall back to "true" even if the -// environment variable is not explicitly defined. -try { - allowReRegistration = globalThis.IS_WORDPRESS_CORE ? false : true; -} catch ( error ) { - allowReRegistration = true; -} +// The safety measure is meant for WordPress core where IS_WORDPRESS_CORE is set to true. +const allowReRegistration = globalThis.IS_WORDPRESS_CORE ? false : true; /** * Called by a @wordpress package wishing to opt-in to accessing or exposing