add test for db insert error