mirror of https://github.com/SeanOMik/libki.git
protocol: Fix typo in MessageBuilder
This commit is contained in:
parent
0a2997e3d7
commit
f2247f03f4
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue