Improve termination error messages

This is an improvement for #276