Added error logging in chat