Avoids raising exceptions in tryInsertID.
Merge pull request #855 from gradha/pr_fixes_try_insert_id

Avoids raising exceptions in tryInsertID.