diff options
author | Tor Egge <Tor.Egge@broadpark.no> | 2019-01-31 16:08:44 +0100 |
---|---|---|
committer | Tor Egge <Tor.Egge@broadpark.no> | 2019-01-31 16:08:44 +0100 |
commit | bd089a5bd722fe9d75b8d96e768288c15403821e (patch) | |
tree | 5121ce0f6e7b1082ebc99a25d505e21ac90aa6ec /config | |
parent | 55cf60201e329604e19ef0ff7ac1f5300716742a (diff) |
Use formatting to build exception messages.
Diffstat (limited to 'config')
-rw-r--r-- | config/src/vespa/config/configgen/value_converter.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/config/src/vespa/config/configgen/value_converter.cpp b/config/src/vespa/config/configgen/value_converter.cpp index 4241b5354fd..1f78e78cc32 100644 --- a/config/src/vespa/config/configgen/value_converter.cpp +++ b/config/src/vespa/config/configgen/value_converter.cpp @@ -2,6 +2,7 @@ #include "value_converter.h" #include <vespa/config/common/exceptions.h> #include <vespa/vespalib/locale/c.h> +#include <vespa/vespalib/util/stringfmt.h> using namespace vespalib; using namespace vespalib::slime; @@ -17,7 +18,7 @@ int32_t convertValue(const ::vespalib::slime::Inspector & __inspector) { case DOUBLE::ID: return static_cast<int32_t>(__inspector.asDouble()); case STRING::ID: return static_cast<int32_t>(strtoll(__inspector.asString().make_string().c_str(), 0, 0)); } - throw InvalidConfigException("Expected int32_t, but got incompatible config type " + __inspector.type().getId()); + throw InvalidConfigException(make_string("Expected int32_t, but got incompatible config type %u", __inspector.type().getId())); } template<> @@ -27,7 +28,7 @@ int64_t convertValue(const ::vespalib::slime::Inspector & __inspector) { case DOUBLE::ID: return static_cast<int64_t>(__inspector.asDouble()); case STRING::ID: return static_cast<int64_t>(strtoll(__inspector.asString().make_string().c_str(), 0, 0)); } - throw InvalidConfigException("Expected int64_t, but got incompatible config type " + __inspector.type().getId()); + throw InvalidConfigException(make_string("Expected int64_t, but got incompatible config type %u", __inspector.type().getId())); } template<> @@ -37,7 +38,7 @@ double convertValue(const ::vespalib::slime::Inspector & __inspector) { case DOUBLE::ID: return static_cast<double>(__inspector.asDouble()); case STRING::ID: return static_cast<double>(vespalib::locale::c::strtod(__inspector.asString().make_string().c_str(), 0)); } - throw InvalidConfigException("Expected double, but got incompatible config type " + __inspector.type().getId()); + throw InvalidConfigException(make_string("Expected double, but got incompatible config type %u", __inspector.type().getId())); } template<> @@ -48,7 +49,7 @@ bool convertValue(const ::vespalib::slime::Inspector & __inspector) { vespalib::string s(__inspector.asString().make_string()); return s.compare("true") == 0 ? true : false; } - throw InvalidConfigException("Expected bool, but got incompatible config type " + __inspector.type().getId()); + throw InvalidConfigException(make_string("Expected bool, but got incompatible config type %u", __inspector.type().getId())); } template<> |