\hypertarget{doc_decisions_error_code_implementation_md_autotoc_md1160}{}\doxysection{Problem}\label{doc_decisions_error_code_implementation_md_autotoc_md1160}
In the previous error concept it was very useful to generate macros as we often added new errors. The code generation itself, however, is quite complicated (C++ code that prints the code; which is also not ideal for cross compilation, see also \href{https://github.com/ElektraInitiative/libelektra/issues/2814}{\texttt{ https\+://github.\+com/\+Elektra\+Initiative/libelektra/issues/2814}}).\hypertarget{doc_decisions_error_code_implementation_md_autotoc_md1161}{}\doxysection{Constraints}\label{doc_decisions_error_code_implementation_md_autotoc_md1161}
\hypertarget{doc_decisions_error_code_implementation_md_autotoc_md1162}{}\doxysection{Assumptions}\label{doc_decisions_error_code_implementation_md_autotoc_md1162}

\begin{DoxyItemize}
\item Error codes do not change very often
\end{DoxyItemize}\hypertarget{doc_decisions_error_code_implementation_md_autotoc_md1163}{}\doxysection{Considered Alternatives}\label{doc_decisions_error_code_implementation_md_autotoc_md1163}

\begin{DoxyItemize}
\item Migrate to a more modern and easier way to generate code with our mustache system, and let this generate the (mapping) code for all compiled languages (C, C++, Java, Rust, Go). All we get out of this is the removal of {\ttfamily std\+::cout $<$$<$ ...} code from C++ but not much more.
\item Migrate to C\+Make code that generates such macros/classes (see also \href{https://github.com/ElektraInitiative/libelektra/issues/2814}{\texttt{ https\+://github.\+com/\+Elektra\+Initiative/libelektra/issues/2814}}) Mustache templates have to be supplied with the input data somehow. Either we have to use a custom executable that is compiled at build time. In that case we would just get rid of the std\+::cout $<$$<$ ... in the C++ code, but not much else would change. The other option is to use the default mustache executable, which is a Ruby script and therefore requires Ruby to be installed. Also kdb gen cannot be reused, since that would require compiling kdb first, which needs \mbox{\hyperlink{kdberrors_8h}{kdberrors.\+h}}.
\end{DoxyItemize}\hypertarget{doc_decisions_error_code_implementation_md_autotoc_md1164}{}\doxysection{Decision}\label{doc_decisions_error_code_implementation_md_autotoc_md1164}
Write down the few macros manually, and also manually write down exceptions for the language bindings (and also the mappings from Elektra\textquotesingle{}s internal errors to nice errors specific for the languages)

Since error codes and crucial parts Elektra\textquotesingle{}s core implementation will not change often this is the best approach with minimal effort.

The existing code will be refactored so that error macros directly call macros.

When adding a new error code, language bindings have to be adapted accordingly such as the Rust or Java Binding.\hypertarget{doc_decisions_error_code_implementation_md_autotoc_md1165}{}\doxysection{Rationale}\label{doc_decisions_error_code_implementation_md_autotoc_md1165}

\begin{DoxyItemize}
\item Updates to error codes will imply syncing every binding. This though should happen in very rare circumstances.
\end{DoxyItemize}\hypertarget{doc_decisions_error_code_implementation_md_autotoc_md1166}{}\doxysection{Implications}\label{doc_decisions_error_code_implementation_md_autotoc_md1166}

\begin{DoxyItemize}
\item The current bindings stay untouched
\item Tutorial on how to write a binding should be written
\end{DoxyItemize}\hypertarget{doc_decisions_error_code_implementation_md_autotoc_md1167}{}\doxysection{Related Decisions}\label{doc_decisions_error_code_implementation_md_autotoc_md1167}
\hypertarget{doc_decisions_error_code_implementation_md_autotoc_md1168}{}\doxysection{Notes}\label{doc_decisions_error_code_implementation_md_autotoc_md1168}

\begin{DoxyItemize}
\item \href{https://github.com/ElektraInitiative/libelektra/issues/2871}{\texttt{ https\+://github.\+com/\+Elektra\+Initiative/libelektra/issues/2871}}
\item \href{https://github.com/ElektraInitiative/libelektra/issues/2814}{\texttt{ https\+://github.\+com/\+Elektra\+Initiative/libelektra/issues/2814}} 
\end{DoxyItemize}