Exception handling for invalid message