univalue: make spaceStr thread-safe

Simply add spaces to the existing string instead of using a
temporary.

Fixes #4756.
Cleanup messy error messages
Merge pull request #4839

346193b Cleanup messy error messages (R E Broadley)
Merge pull request #4851

41ef558 univalue: make spaceStr thread-safe (Wladimir J. van der Laan)