Merge "Better error message for unexpected exceptions." into tm-dev