For normal exception create a general function which logs any exception into the database like
public void LogException(Exception ex)
{
}
Now from catch block call this function to log.
catch(Exception ex)
LogException(ex);
You can also check the Type of exception inside LogException
function to log specific values for an exception.