exception catching when handling chat