protocol: Fix typo in MessageBuilder

This commit is contained in:
Joshua Scott 2018-04-06 04:24:10 +01:00
parent 0a2997e3d7
commit f2247f03f4
1 changed files with 7 additions and 3 deletions

View File

@ -1,6 +1,8 @@
#pragma once #pragma once
#include "Message.h" #include "Message.h"
#include "ki/protocol/exception.h"
#include <string> #include <string>
#include <sstream>
namespace ki namespace ki
{ {
@ -20,10 +22,12 @@ namespace dml
template <typename ValueT> template <typename ValueT>
MessageBuilder &set_field_value(std::string name, ValueT value) MessageBuilder &set_field_value(std::string name, ValueT value)
{ {
auto *field = m_message->get_record().get_field<ValueT>(name); auto *field = m_message->get_record()->get_field<ValueT>(name);
if (!field) 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); field->set_value(value);
return *this; return *this;