Hello. Been programming OOP for the past year. I am very ashamed to admit that I have not learned about exceptions yet. Well actually Im not sure...
Am I using them correctly?
public function indexAction(Request $request)
{
try {
if(!is_object($request))
throw new \Exception('Param msut be an object');
} catch(Exception $e) {
$this->logger = $this->get('logger');
$this->logger->info("You have the following error: { $error }", array("error" => $e->getMessage()));
}
}
I throw an exception in order for the error to appear on the screen. Then I catch the error and log it. Is this the correct usage? Or is there more?
Thanks!