Skip to content

Commit

Permalink
Private APIs: remove obsolete try/catch block (WordPress#65898)
Browse files Browse the repository at this point in the history
Co-authored-by: jsnajdr <[email protected]>
Co-authored-by: sirreal <[email protected]>
  • Loading branch information
3 people authored and karthick-murugan committed Nov 13, 2024
1 parent f6b4b30 commit e42b423
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions packages/private-apis/src/implementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e42b423

Please sign in to comment.