How to handle errors in symfony2 using try catch and store the error in custom db table like we do in C#.
eg
try
{
// code with exception.
}
catch(Exception ex)
{
//get the error and store information in table
}
You can use the PHP try-catch block to catch exceptions as you mentioned. You can have a look to this answer: How to catch Exception in symfony 2?
With this method you can catch exceptions for the given code block. If you want to catch all exceptions in generally, then you should write an EventListener class, that will be fired if any uncatched exception occurs.
In the Symfony2 cookbook there is an example of writing an exception handler class: How to create an Event Listener