Catch PDO error when no connection is set

When no connection is set, the profiler crashes. Catch the PDO exception, to make it work without database.