Skip to content

Instantly share code, notes, and snippets.

@coreymcmahon
Created June 14, 2012 11:52
Show Gist options
  • Save coreymcmahon/2929838 to your computer and use it in GitHub Desktop.
Save coreymcmahon/2929838 to your computer and use it in GitHub Desktop.
Example of an Exception Controller that responds to exception events in our framework - http://www.symfonycentral.com
<?php
namespace Calendar\Controller;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\FlattenException;
class ErrorController
{
public function exceptionAction(FlattenException $exception)
{
$msg = 'Something went wrong! ('.$exception->getMessage().')';
return new Response($msg, $exception->getStatusCode());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment