Skip to content

Commit

Permalink
dev/core#3502 - CiviEventDispatcher - Tune down the warning
Browse files Browse the repository at this point in the history
  • Loading branch information
totten committed Jun 14, 2022
1 parent 1900030 commit f3ec3f9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Civi/Core/CiviEventDispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,12 @@ public function dispatch($eventName, Event $event = NULL) {
// This condition indicates a structural problem and merits a consistent failure-mode.
// If you believe some special case merits an exemption, then you could add it to `$bootDispatchPolicy`.

throw new \RuntimeException("The event \"$eventName\" attempted to fire before CiviCRM was fully loaded. Skipping.");
// An `Exception` would be ideal for preventing new bugs, but it can be too noisy for systems with pre-existing bugs.
// throw new \RuntimeException("The event \"$eventName\" attempted to fire before CiviCRM was fully loaded. Skipping.");
// Complain to web-user and sysadmin. Log a backtrace. We're pre-boot, so don't use high-level services.
error_log("The event \"$eventName\" attempted to fire before CiviCRM was fully loaded. Skipping.\n" . \CRM_Core_Error::formatBacktrace(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), FALSE));
trigger_error("The event \"$eventName\" attempted to fire before CiviCRM was fully loaded. Skipping.", E_USER_WARNING);
return $event;

default:
throw new \RuntimeException("The dispatch policy for \"$eventName\" is unrecognized ($mode).");
Expand Down

0 comments on commit f3ec3f9

Please sign in to comment.