Issue 626 by Pjohans: try catch on drupal_write_record to catch unhandle...

...d PDO exception.

Issue 626 describes an unhandled PDO exception which causes the page to crash. I couldn't recreate the issue locally, but am 99% sure that it origins from drupal_write_record in ting.controllers.inc. Either way the code potentially throws an unhandled exception, so the try catch can do no harm.
you're right - if either of the two last queries fails ting_object will have vid=0 (default value) which will cause the next insert to fail since vid has a unique constraint. We need a rollback