refactor: generate exception msg in a simpler way

boost::lexical_cast is too heavy for this purpose.  Instead, we:

1. Only format status code of 3 digits;
2. Unroll the loop to fill the three digits.