Change error handling to properly populate string from printf parameters

This should fix an error D was seeing when we were passing in parameters with a colon which gets translated to `%3A` which printf misinterprets as a substitution and errors.