if (!$customer->getId()) { Mage::throwException('Customer not found.'); }
if (!$checkout->validate()) { Mage::throwException('Checkout validation failed.'); }
if (!$shippingAddress->validate()) { Mage::throwException('Shipping address validation failed.'); }In this example, if the shipping address fails validation, a "Shipping address validation failed" exception will be thrown. Mage::throwException is part of the Magento Core package library, which is included with the Magento framework.