diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/codec-json/json.tmpl.h | 5 | ||||
-rw-r--r-- | src/core/error.h | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/codec-json/json.tmpl.h b/src/codec-json/json.tmpl.h index 9a28fe9..2bbfa5d 100644 --- a/src/codec-json/json.tmpl.h +++ b/src/codec-json/json.tmpl.h @@ -71,7 +71,6 @@ struct json_encode<schema::String, RootSchema, FromEncode> { template<typename... T, typename RootSchema, typename FromEncode> struct json_encode<schema::Tuple<T...>, RootSchema, FromEncode> { - template<size_t i> static error_or<void> encode_element(const data<schema::Tuple<T...>, FromEncode>& from, buffer& to){ auto eov = json_encode<typename parameter_pack_type<i, T...>::type, RootSchema, FromEncode>::encode(from.template get<i>(), to); @@ -484,9 +483,7 @@ struct json_decode<schema::Struct<schema::Member<T,Lits>...>, RootSchema, ToDeco constexpr static string_literal Literal = parameter_key_pack_type<i, Lits...>::literal; if(search_name == Literal.view()){ if(fields[i]){ - // TODO Change to this. Maybe - // return make_error<err::already_exists>(); - return make_error<err::invalid_state>(); + return make_error<err::already_exists>(); } fields[i] = true; auto eov = json_decode<Type, RootSchema, ToDecode>::decode(buff, to.template get<Literal>()); diff --git a/src/core/error.h b/src/core/error.h index 493147f..abd979b 100644 --- a/src/core/error.h +++ b/src/core/error.h @@ -159,6 +159,11 @@ struct not_implemented { static constexpr std::string_view description = "Not implemented"; static constexpr bool is_critical = true; }; + +struct already_exists { + static constexpr std::string_view description = "Already exists"; + static constexpr bool is_critical = false; +}; } /** |