I am wondering how would I simulate a 500 error in Symfony 2.
I have been reading this post where Raise suggests throwing an exception
You can do it like this.
//in your controller
$response = new Response();
$response->setStatusCode(500);
return $response;
Dont forget to add
use Symfony\Component\HttpFoundation\Response;
at the top of your file.
Edit : To force Symfony 500 error, your proposition is fine :
throw new \Exception('Something went wrong!');
Put it in a controller function.