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

... as suggested by the coding style guide.

This is a clean retry of PR #8314 which i screwed up in rebase-land.

@pcwalton: r?