Please someone tell me how to stop process(flow) of any event observer.

i.e an event observer if - "before_create_account"

i know this i can use this event and do something before a new account create. But what i have to do if i want to stop actual process of this event. i want to stop flow. If some condition is false then user will not able to create account. i want to check some condition before account create and if that condition is false new account registration should be rejected. what code i have to write for this.

  • before_create_account is just an example i know its not true event
  • for that you can throw the error from observer itself if the required not met, then it will stop further steps after that once you throw error Feb 9, 2016 at 6:21
  • can you please show me ? please write your reply in answer Feb 9, 2016 at 6:23
  • can i use this? Mage::throwException('My Error message') because lots of code there. which confuse me Feb 9, 2016 at 7:03
  • When using Mage::throwException($helper->__('My Error message')), it is conventional that the error message be user-friendly enough to show directly to the end-user. That is, translated to the proper locale and not containing any sensitive diagnostic details that the user shouldn't see. In most cases, throwing a straight up \Exception will cause a the provided error message to be swallowed up and a generic one presented to the user in its place. May 3, 2016 at 3:25

1 Answer 1


The event observer system of Magento does not have its own mechanism to stop processing whatever happens after the event. So most of the time the only solution is to throw an exception and hope that it will be catched appropiately.

Depending on the code where the event is dispatched, this can yield different outcomes:

  1. the exception gets caught and logged (or silently swallowed) and a generic error message is shown to the user
  2. the exception gets caught and its message is shown to the user
  3. the exception is not caught and the user sees the dreaded "There was an error processing your request" or a plain "Internal Server Error" page.

See also: How prevent a model data save using _save_before event

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.