Adjust the error messages to match the pattern "expected foo, found bar"

Closes #8492