added extra error handeling into the database class to help first time users of the framework