I think you should catch InvalidMessage exception here