I found different cases to use Magento throw exception, I want to know what is the difference between (Mage_Core_Exception $e) and (Exception $e) ? I found What's the preferred way of throwing exceptions in Magento? answer, but it's not precise for me. Is Mage::throwException is the correct one and that we should use ?

1 Answer 1


This is just PHP type hinting ... the one expects $e to be element of class Exception, the other one expects Mage_Core_Exception.

Since class Mage_Core_Exception extends Exception the only "differences" are three changed methods.

For Mage::throwException() see app/Mage.php. At the end it is throws a new exception of class Mage_Core_Exception (thats child of PHPs Exception).

public static function throwException($message, $messageStorage = null)
    if ($messageStorage && ($storage = self::getSingleton($messageStorage))) {
    throw new Mage_Core_Exception($message);
  • The three changed methods link doesn't work, however your answer does not answer my question, I want to know exactly the difference between, according to you answer you mean that (Exception $e) and (Mage_Core_Exception $e) is the same thing and there no difference ?
    – PЯINCƎ
    Commented Jul 31, 2017 at 21:01
  • Yes, exactly. Only the behavior of the (now correctly linked) mehtods changed. So go for Mage_Core_Exception and Mage::throwException() :)
    – sv3n
    Commented Jul 31, 2017 at 21:03
  • 1
    I'll downvote your answer because you you gave me a link that not working :)
    – PЯINCƎ
    Commented Jul 31, 2017 at 21:04
  • @Prince it's okay if you'd accept at least :P
    – sv3n
    Commented Aug 4, 2017 at 0:32
  • I accept on condition if you give a few points :)
    – PЯINCƎ
    Commented Aug 4, 2017 at 18:36

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.