Ticket #2 Better Error handling for database queries

Added try- catch block for exception handling when error occurs due to database queries