diff --git a/include/ki/protocol/dml/MessageBuilder.h b/include/ki/protocol/dml/MessageBuilder.h index 2b2e134..33995eb 100644 --- a/include/ki/protocol/dml/MessageBuilder.h +++ b/include/ki/protocol/dml/MessageBuilder.h @@ -1,6 +1,8 @@ #pragma once #include "Message.h" +#include "ki/protocol/exception.h" #include +#include namespace ki { @@ -20,10 +22,12 @@ namespace dml template MessageBuilder &set_field_value(std::string name, ValueT value) { - auto *field = m_message->get_record().get_field(name); + auto *field = m_message->get_record()->get_field(name); if (!field) { - // TODO: Exceptions + std::ostringstream oss; + oss << "No field with name " << name << " exists with specified type."; + throw value_error(oss.str()); } field->set_value(value); return *this; @@ -35,4 +39,4 @@ namespace dml }; } } -} \ No newline at end of file +}