several testing code for exception handling and error logging