From 9d237c68b7ce6cdefc645daad5fa1fc57a2d80be Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Sat, 1 Jul 2023 12:18:57 +0200 Subject: c++,core,codec-json: Changed an error --- src/codec-json/json.tmpl.h | 5 +---- 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 { template struct json_encode, RootSchema, FromEncode> { - template static error_or encode_element(const data, FromEncode>& from, buffer& to){ auto eov = json_encode::type, RootSchema, FromEncode>::encode(from.template get(), to); @@ -484,9 +483,7 @@ struct json_decode...>, RootSchema, ToDeco constexpr static string_literal Literal = parameter_key_pack_type::literal; if(search_name == Literal.view()){ if(fields[i]){ - // TODO Change to this. Maybe - // return make_error(); - return make_error(); + return make_error(); } fields[i] = true; auto eov = json_decode::decode(buff, to.template get()); 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; +}; } /** -- cgit v1.2.3