Skip to content
Snippets Groups Projects
Commit bb524026 authored by totten's avatar totten
Browse files

#3502 - CiviEventDispatcher - Tweak error message. Add explanation.

parent 1eb7f2b3
No related branches found
No related tags found
No related merge requests found
......@@ -187,7 +187,13 @@ class CiviEventDispatcher extends EventDispatcher {
throw new \RuntimeException("The dispatch policy prohibits event \"$eventName\".");
case 'not-ready':
throw new \RuntimeException("CiviCRM has not bootstrapped sufficiently to fire event \"$eventName\".");
// The system is not ready to run hooks -- eg it has not finished loading the extension main-files.
// If you fire a hook at this point, it will not be received by the intended listeners.
// In practice, many hooks involve cached data-structures, so a premature hook is liable to have spooky side-effects.
// 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.");
default:
throw new \RuntimeException("The dispatch policy for \"$eventName\" is unrecognized ($mode).");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment