Improve error messages for failed expressions

fixes #8076