\hypertarget{elektra__error_8c}{}\doxysection{elektra\+\_\+error.\+c File Reference}
\label{elektra__error_8c}\index{elektra\_error.c@{elektra\_error.c}}


Elektra error codes.  


{\ttfamily \#include \char`\"{}elektra/conversion.\+h\char`\"{}}\newline
{\ttfamily \#include \char`\"{}elektra/error.\+h\char`\"{}}\newline
{\ttfamily \#include \char`\"{}kdberrors.\+h\char`\"{}}\newline
{\ttfamily \#include \char`\"{}kdbhelper.\+h\char`\"{}}\newline
{\ttfamily \#include \char`\"{}kdbprivate.\+h\char`\"{}}\newline
{\ttfamily \#include $<$string.\+h$>$}\newline
Include dependency graph for elektra\+\_\+error.\+c\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{elektra__error_8c__incl}
\end{center}
\end{figure}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
Elektra\+Error $\ast$ \mbox{\hyperlink{elektra__error_8c_a0affd2cf7caf29441bf7cdf1d7cbb351}{elektra\+Error\+Create}} (const char $\ast$code, const char $\ast$description, const char $\ast$module, const char $\ast$file, kdb\+\_\+long\+\_\+t line)
\begin{DoxyCompactList}\small\item\em Creates a new Elektra\+Error using the provided values. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{elektra__error_8c_a5b397979459c52ed2031d7b997679fca}{elektra\+Error\+Add\+Warning}} (Elektra\+Error $\ast$error, Elektra\+Error $\ast$warning)
\begin{DoxyCompactList}\small\item\em Adds a warning to an existing Elektra\+Error struct. \end{DoxyCompactList}\item 
Elektra\+Error $\ast$ \mbox{\hyperlink{elektra__error_8c_a8634e58bc4cda4babdc73247fc55e25a}{elektra\+Error\+From\+Key}} (Key $\ast$key)
\begin{DoxyCompactList}\small\item\em Extracts the error and all warnings from the given key. \end{DoxyCompactList}\item 
Elektra\+Error $\ast$ \mbox{\hyperlink{elektra__error_8c_a02947b47c6ddd80d97f76a52677aac4a}{elektra\+Error\+Key\+Not\+Found}} (const char $\ast$keyname)
\begin{DoxyCompactList}\small\item\em Creates a \char`\"{}\+Key not found\char`\"{} error. \end{DoxyCompactList}\item 
Elektra\+Error $\ast$ \mbox{\hyperlink{elektra__error_8c_a4925bb1b9eb65b1be0cc46982888b4c4}{elektra\+Error\+Wrong\+Type}} (const char $\ast$keyname, KDBType expected\+Type, KDBType actual\+Type)
\begin{DoxyCompactList}\small\item\em Creates a \char`\"{}\+Wrong type\char`\"{} error. \end{DoxyCompactList}\item 
Elektra\+Error $\ast$ \mbox{\hyperlink{elektra__error_8c_a69e23143abcac7e05dd2d1d9d42ddc66}{elektra\+Error\+Null\+Error}} (const char $\ast$function)
\begin{DoxyCompactList}\small\item\em Creates a \char`\"{}\+Null error argument\char`\"{} error. \end{DoxyCompactList}\item 
Elektra\+Error $\ast$ \mbox{\hyperlink{elektra__error_8c_a0502511a13c56789990a707df8554b11}{elektra\+Error\+Conversion\+To\+String}} (KDBType source\+Type, const char $\ast$keyname)
\begin{DoxyCompactList}\small\item\em Creates a \char`\"{}\+Conversion to string failed\char`\"{} error. \end{DoxyCompactList}\item 
Elektra\+Error $\ast$ \mbox{\hyperlink{elektra__error_8c_a0100203350617d65ea7efb6837b888a8}{elektra\+Error\+Conversion\+From\+String}} (KDBType target\+Type, const char $\ast$keyname, const char $\ast$source\+Value)
\begin{DoxyCompactList}\small\item\em Creates a \char`\"{}\+Conversion from string failed\char`\"{} error. \end{DoxyCompactList}\item 
Elektra\+Error $\ast$ \mbox{\hyperlink{elektra__error_8c_af4cf78d228873109ad3a4db60d0f26a1}{elektra\+Error\+Minimal\+Validation\+Failed}} (const char $\ast$application)
\begin{DoxyCompactList}\small\item\em Creates a \char`\"{}minimal validation failed\char`\"{} error. \end{DoxyCompactList}\item 
Elektra\+Error $\ast$ \mbox{\hyperlink{group__highlevel_ga4895fb4c40822a11219846b189395db0}{elektra\+Error\+Pure\+Warning}} (void)
\begin{DoxyCompactList}\small\item\em Creates a dummy Elektra\+Error struct to store warnings in. \end{DoxyCompactList}\item 
const char $\ast$ \mbox{\hyperlink{group__highlevel_ga22c0775760a9f42f29337c06bf8b2ab5}{elektra\+Error\+Code}} (const Elektra\+Error $\ast$error)
\item 
const char $\ast$ \mbox{\hyperlink{group__highlevel_ga781cda83af3981a55321e7c613afbef0}{elektra\+Error\+Description}} (const Elektra\+Error $\ast$error)
\item 
void \mbox{\hyperlink{group__highlevel_ga591f7ed4b57a341928bf7bb3d7adb693}{elektra\+Error\+Reset}} (Elektra\+Error $\ast$$\ast$error)
\begin{DoxyCompactList}\small\item\em Frees the memory used by the error and sets the referenced error variable to NULL. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
Elektra error codes. 

\begin{DoxyCopyright}{Copyright}
BSD License (see doc/\+LICENSE.\+md or \href{http://www.libelektra.org}{\texttt{ http\+://www.\+libelektra.\+org}}) 
\end{DoxyCopyright}


\doxysubsection{Function Documentation}
\mbox{\Hypertarget{elektra__error_8c_a5b397979459c52ed2031d7b997679fca}\label{elektra__error_8c_a5b397979459c52ed2031d7b997679fca}} 
\index{elektra\_error.c@{elektra\_error.c}!elektraErrorAddWarning@{elektraErrorAddWarning}}
\index{elektraErrorAddWarning@{elektraErrorAddWarning}!elektra\_error.c@{elektra\_error.c}}
\doxysubsubsection{\texorpdfstring{elektraErrorAddWarning()}{elektraErrorAddWarning()}}
{\footnotesize\ttfamily void elektra\+Error\+Add\+Warning (\begin{DoxyParamCaption}\item[{Elektra\+Error $\ast$}]{error,  }\item[{Elektra\+Error $\ast$}]{warning }\end{DoxyParamCaption})}



Adds a warning to an existing Elektra\+Error struct. 

If you want to report a warning without an error, create a dummy error with \mbox{\hyperlink{group__highlevel_ga4895fb4c40822a11219846b189395db0}{elektra\+Error\+Pure\+Warning()}} and then add a warning to it.


\begin{DoxyParams}{Parameters}
{\em error} & The error to which {\ttfamily warning} shall be added. \\
\hline
{\em warning} & The warning to add. Once added it is owned by {\ttfamily error}. DO NOT call \mbox{\hyperlink{group__highlevel_ga591f7ed4b57a341928bf7bb3d7adb693}{elektra\+Error\+Reset()}} on it afterwards. \\
\hline
\end{DoxyParams}
\mbox{\Hypertarget{elektra__error_8c_a0100203350617d65ea7efb6837b888a8}\label{elektra__error_8c_a0100203350617d65ea7efb6837b888a8}} 
\index{elektra\_error.c@{elektra\_error.c}!elektraErrorConversionFromString@{elektraErrorConversionFromString}}
\index{elektraErrorConversionFromString@{elektraErrorConversionFromString}!elektra\_error.c@{elektra\_error.c}}
\doxysubsubsection{\texorpdfstring{elektraErrorConversionFromString()}{elektraErrorConversionFromString()}}
{\footnotesize\ttfamily Elektra\+Error$\ast$ elektra\+Error\+Conversion\+From\+String (\begin{DoxyParamCaption}\item[{KDBType}]{target\+Type,  }\item[{const char $\ast$}]{keyname,  }\item[{const char $\ast$}]{source\+Value }\end{DoxyParamCaption})}



Creates a \char`\"{}\+Conversion from string failed\char`\"{} error. 


\begin{DoxyParams}{Parameters}
{\em target\+Type} & The type into which {\ttfamily source\+Value} couldn\textquotesingle{}t be converted. \\
\hline
{\em keyname} & The name of the key that couldn\textquotesingle{}t be converted. \\
\hline
{\em source\+Value} & The value that couldn\textquotesingle{}t be converted.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A newly allocated Elektra\+Error (free with \mbox{\hyperlink{group__highlevel_ga591f7ed4b57a341928bf7bb3d7adb693}{elektra\+Error\+Reset()}}). 
\end{DoxyReturn}
\mbox{\Hypertarget{elektra__error_8c_a0502511a13c56789990a707df8554b11}\label{elektra__error_8c_a0502511a13c56789990a707df8554b11}} 
\index{elektra\_error.c@{elektra\_error.c}!elektraErrorConversionToString@{elektraErrorConversionToString}}
\index{elektraErrorConversionToString@{elektraErrorConversionToString}!elektra\_error.c@{elektra\_error.c}}
\doxysubsubsection{\texorpdfstring{elektraErrorConversionToString()}{elektraErrorConversionToString()}}
{\footnotesize\ttfamily Elektra\+Error$\ast$ elektra\+Error\+Conversion\+To\+String (\begin{DoxyParamCaption}\item[{KDBType}]{source\+Type,  }\item[{const char $\ast$}]{keyname }\end{DoxyParamCaption})}



Creates a \char`\"{}\+Conversion to string failed\char`\"{} error. 


\begin{DoxyParams}{Parameters}
{\em source\+Type} & The type which failed to be converted to string. \\
\hline
{\em keyname} & The name of the key that couldn\textquotesingle{}t be converted.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A newly allocated Elektra\+Error (free with \mbox{\hyperlink{group__highlevel_ga591f7ed4b57a341928bf7bb3d7adb693}{elektra\+Error\+Reset()}}). 
\end{DoxyReturn}
\mbox{\Hypertarget{elektra__error_8c_a0affd2cf7caf29441bf7cdf1d7cbb351}\label{elektra__error_8c_a0affd2cf7caf29441bf7cdf1d7cbb351}} 
\index{elektra\_error.c@{elektra\_error.c}!elektraErrorCreate@{elektraErrorCreate}}
\index{elektraErrorCreate@{elektraErrorCreate}!elektra\_error.c@{elektra\_error.c}}
\doxysubsubsection{\texorpdfstring{elektraErrorCreate()}{elektraErrorCreate()}}
{\footnotesize\ttfamily Elektra\+Error$\ast$ elektra\+Error\+Create (\begin{DoxyParamCaption}\item[{const char $\ast$}]{code,  }\item[{const char $\ast$}]{description,  }\item[{const char $\ast$}]{module,  }\item[{const char $\ast$}]{file,  }\item[{kdb\+\_\+long\+\_\+t}]{line }\end{DoxyParamCaption})}



Creates a new Elektra\+Error using the provided values. 

The returned value will be allocated with \mbox{\hyperlink{internal_8c_a848ed030434c76176167fac6ab79429c}{elektra\+Calloc()}}.


\begin{DoxyParams}{Parameters}
{\em code} & The error code of the error. Must be compile-\/time constant. \\
\hline
{\em description} & The description of the error. Will be copied and stored in the struct. \\
\hline
{\em module} & The module that raised the error. Must be compile-\/time constant. \\
\hline
{\em file} & The file that raised the error. Must be compile-\/time constant. \\
\hline
{\em line} & The line in which the error was raised.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A newly allocated Elektra\+Error (free with \mbox{\hyperlink{group__highlevel_ga591f7ed4b57a341928bf7bb3d7adb693}{elektra\+Error\+Reset()}}). 
\end{DoxyReturn}
\mbox{\Hypertarget{elektra__error_8c_a8634e58bc4cda4babdc73247fc55e25a}\label{elektra__error_8c_a8634e58bc4cda4babdc73247fc55e25a}} 
\index{elektra\_error.c@{elektra\_error.c}!elektraErrorFromKey@{elektraErrorFromKey}}
\index{elektraErrorFromKey@{elektraErrorFromKey}!elektra\_error.c@{elektra\_error.c}}
\doxysubsubsection{\texorpdfstring{elektraErrorFromKey()}{elektraErrorFromKey()}}
{\footnotesize\ttfamily Elektra\+Error$\ast$ elektra\+Error\+From\+Key (\begin{DoxyParamCaption}\item[{Key $\ast$}]{key }\end{DoxyParamCaption})}



Extracts the error and all warnings from the given key. 

If no error exists, a pure warning error will be used. \begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__highlevel_ga4895fb4c40822a11219846b189395db0}{elektra\+Error\+Pure\+Warning}}
\end{DoxySeeAlso}

\begin{DoxyParams}{Parameters}
{\em key} & The to extract error and warnings from.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A newly allocated Elektra\+Error (free with \mbox{\hyperlink{group__highlevel_ga591f7ed4b57a341928bf7bb3d7adb693}{elektra\+Error\+Reset()}}). 
\end{DoxyReturn}
\mbox{\Hypertarget{elektra__error_8c_a02947b47c6ddd80d97f76a52677aac4a}\label{elektra__error_8c_a02947b47c6ddd80d97f76a52677aac4a}} 
\index{elektra\_error.c@{elektra\_error.c}!elektraErrorKeyNotFound@{elektraErrorKeyNotFound}}
\index{elektraErrorKeyNotFound@{elektraErrorKeyNotFound}!elektra\_error.c@{elektra\_error.c}}
\doxysubsubsection{\texorpdfstring{elektraErrorKeyNotFound()}{elektraErrorKeyNotFound()}}
{\footnotesize\ttfamily Elektra\+Error$\ast$ elektra\+Error\+Key\+Not\+Found (\begin{DoxyParamCaption}\item[{const char $\ast$}]{keyname }\end{DoxyParamCaption})}



Creates a \char`\"{}\+Key not found\char`\"{} error. 


\begin{DoxyParams}{Parameters}
{\em keyname} & The name of the key that wasn\textquotesingle{}t found.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A newly allocated Elektra\+Error (free with \mbox{\hyperlink{group__highlevel_ga591f7ed4b57a341928bf7bb3d7adb693}{elektra\+Error\+Reset()}}). 
\end{DoxyReturn}
\mbox{\Hypertarget{elektra__error_8c_af4cf78d228873109ad3a4db60d0f26a1}\label{elektra__error_8c_af4cf78d228873109ad3a4db60d0f26a1}} 
\index{elektra\_error.c@{elektra\_error.c}!elektraErrorMinimalValidationFailed@{elektraErrorMinimalValidationFailed}}
\index{elektraErrorMinimalValidationFailed@{elektraErrorMinimalValidationFailed}!elektra\_error.c@{elektra\_error.c}}
\doxysubsubsection{\texorpdfstring{elektraErrorMinimalValidationFailed()}{elektraErrorMinimalValidationFailed()}}
{\footnotesize\ttfamily Elektra\+Error$\ast$ elektra\+Error\+Minimal\+Validation\+Failed (\begin{DoxyParamCaption}\item[{const char $\ast$}]{application }\end{DoxyParamCaption})}



Creates a \char`\"{}minimal validation failed\char`\"{} error. 


\begin{DoxyParams}{Parameters}
{\em application} & parent key as passed to \mbox{\hyperlink{group__highlevel_ga45de58b05c7a8ab02f6c54ddd31a56e1}{elektra\+Open()}}\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A newly allocated Elektra\+Error (free with \mbox{\hyperlink{group__highlevel_ga591f7ed4b57a341928bf7bb3d7adb693}{elektra\+Error\+Reset()}}). 
\end{DoxyReturn}
\mbox{\Hypertarget{elektra__error_8c_a69e23143abcac7e05dd2d1d9d42ddc66}\label{elektra__error_8c_a69e23143abcac7e05dd2d1d9d42ddc66}} 
\index{elektra\_error.c@{elektra\_error.c}!elektraErrorNullError@{elektraErrorNullError}}
\index{elektraErrorNullError@{elektraErrorNullError}!elektra\_error.c@{elektra\_error.c}}
\doxysubsubsection{\texorpdfstring{elektraErrorNullError()}{elektraErrorNullError()}}
{\footnotesize\ttfamily Elektra\+Error$\ast$ elektra\+Error\+Null\+Error (\begin{DoxyParamCaption}\item[{const char $\ast$}]{function }\end{DoxyParamCaption})}



Creates a \char`\"{}\+Null error argument\char`\"{} error. 


\begin{DoxyParams}{Parameters}
{\em function} & The name of the function that was called with a null pointer error argument.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A newly allocated Elektra\+Error (free with \mbox{\hyperlink{group__highlevel_ga591f7ed4b57a341928bf7bb3d7adb693}{elektra\+Error\+Reset()}}). 
\end{DoxyReturn}
\mbox{\Hypertarget{elektra__error_8c_a4925bb1b9eb65b1be0cc46982888b4c4}\label{elektra__error_8c_a4925bb1b9eb65b1be0cc46982888b4c4}} 
\index{elektra\_error.c@{elektra\_error.c}!elektraErrorWrongType@{elektraErrorWrongType}}
\index{elektraErrorWrongType@{elektraErrorWrongType}!elektra\_error.c@{elektra\_error.c}}
\doxysubsubsection{\texorpdfstring{elektraErrorWrongType()}{elektraErrorWrongType()}}
{\footnotesize\ttfamily Elektra\+Error$\ast$ elektra\+Error\+Wrong\+Type (\begin{DoxyParamCaption}\item[{const char $\ast$}]{keyname,  }\item[{KDBType}]{expected\+Type,  }\item[{KDBType}]{actual\+Type }\end{DoxyParamCaption})}



Creates a \char`\"{}\+Wrong type\char`\"{} error. 


\begin{DoxyParams}{Parameters}
{\em keyname} & The name of the key that had the wrong type. \\
\hline
{\em expected\+Type} & The type that was expected. \\
\hline
{\em actual\+Type} & The type that was actually found.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A newly allocated Elektra\+Error (free with \mbox{\hyperlink{group__highlevel_ga591f7ed4b57a341928bf7bb3d7adb693}{elektra\+Error\+Reset()}}). 
\end{DoxyReturn}
