The Spanner team reported that checking for specific error strings are error-prone as the returned string can change without notice.
I think they're specifically referring to this line:
If this can be fixed, that would be great.