How to use Exceptions

   $error = false;
   try
   {
    $response = $comm->sendRequestToPaymentGate($this);
   }
   catch(Exception $e)
   {
    $error = $e;
    $response = null;
   }
   // Save the response's values
   $this->loadEnrollmentResponse($response);
  }
 
  // Save the progress so transaction process can be continued in the future
  $this->save();
 
  if($error !== false)
  {
   Mage::throwException($error->getMessage());
  }