It's better to use different error message for each different things (L233 and L248). lexical_cast<string>(error.as<unsigned int>())?