handle exceptions in messages