add exception guard to db operation

add exception guard to db operation, this will prevent CI server from reporting positive failure when db operations error occur.