Logging exceptions is a tricky business. It is necessary to log as many information as possible to track potential attacks, but at the same time it can result in logging sensitive information in logs, which results in a vulnerability. See OWASP guidelines for more details.
RSPEC-1166 should stop raising issues on dynamically created messages as it shows that the developer added some context to the error message.
However the rule should still raise an issue on the following code as the exception message is rarely enough to understand what happened exactly.
And of course an issue should be raised on hardcoded messages as they don't give enough context: