Avoid std::string -> (char *) roundtrip in createStringError() (NFC) (#93242)

The current API first creates a temporary std::string, then passes it as
a C string, only to then convert it into a std::string for storage, thus
unnecessarily computing the length of the string and copying it.
14 jobs for main
in 0 seconds and was queued for 0 seconds