To return the exception message.
const char *what() const;
The function what() is used to deliver the msg.str().
Returns the message with which the exception was created.