
\begin{DoxyItemize}
\item infos = Information about error plugin is in keys below
\item infos/author = Markus Raab \href{mailto:elektra@libelektra.org}{\texttt{ elektra@libelektra.\+org}}
\item infos/licence = BSD
\item infos/provides = error
\item infos/needs =
\item infos/recommends =
\item infos/placements = presetstorage
\item infos/status = productive maintained conformant shelltest tested nodep libc configurable discouraged
\item infos/metadata = trigger/warnings trigger/error trigger/error/nofail
\item infos/description = Provokes errors for testing the plugin framework
\end{DoxyItemize}\hypertarget{md_src_plugins_error_README_src_plugins_error_README_md}{}\doxysection{Introduction}\label{md_src_plugins_error_README_src_plugins_error_README_md}
Plugins (should) rarely return an error or warnings, e.\+g. writing the configuration basically only fails on file system problems. Such behavior is difficult to produce for tests.

This plugin tackles this issue by yielding error/warnings on request.\hypertarget{md_src_plugins_error_README_autotoc_md191}{}\doxysection{Installation}\label{md_src_plugins_error_README_autotoc_md191}
See \mbox{\hyperlink{doc_INSTALL_md}{installation}}. The package is called {\ttfamily libelektra5-\/extra}.\hypertarget{md_src_plugins_error_README_autotoc_md192}{}\doxysection{Usage}\label{md_src_plugins_error_README_autotoc_md192}
\hypertarget{md_src_plugins_error_README_autotoc_md193}{}\doxysubsection{By metadata}\label{md_src_plugins_error_README_autotoc_md193}
Mount this plugin additionally with a working resolver and a storage e.\+g.\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{sudo kdb mount error.dump /error error dump}

\end{DoxyCode}


When following metakey is present during storing ({\ttfamily \mbox{\hyperlink{group__kdb_ga11436b058408f83d303ca5e996832bcf}{kdb\+Set()}}}) the keyset\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{trigger/warnings}

\end{DoxyCode}


a warning will be added. The plugin will still return success, but when the following metakey is present\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{trigger/error}

\end{DoxyCode}


the plugin will return with an error.

The value of the metadata needs to contain the number of the requested error or warning.

So an error and warnings can be injected directly with the kdb tool. E.\+g. the warning number C01330\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{kdb meta-\/set system:/error/key trigger/warnings C01330}

\end{DoxyCode}


or the error number C01200 (will not modify the KDB because {\ttfamily \mbox{\hyperlink{group__kdb_ga11436b058408f83d303ca5e996832bcf}{kdb\+Set()}}} will fail for the error plugin then)\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{kdb meta-\/set user:/error/key trigger/error C01200}
\DoxyCodeLine{\# RET:5}

\end{DoxyCode}


When you are finished you can unmount it with\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{sudo kdb umount /error}

\end{DoxyCode}
\hypertarget{md_src_plugins_error_README_autotoc_md194}{}\doxysubsection{By config}\label{md_src_plugins_error_README_autotoc_md194}
To yield an error in \mbox{\hyperlink{group__kdb_ga844e1299a84c3fbf1d3a905c5c893ba5}{kdb\+Open()}} the metadata approach does not work. So the plugin also can yield warning/errors using configuration.

To do that, configure the plugin using\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{on\_open/warnings}
\DoxyCodeLine{on\_open/error}

\end{DoxyCode}


E.\+g. you can use\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{sudo kdb mount error.dump /error error on\_open/error=C03100 dump}

\end{DoxyCode}


Then you get an error on any access, e.\+g.\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{kdb ls system:/error}

\end{DoxyCode}


Will yield error C01200\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{Description: Tried to get a key from a missing backend}
\DoxyCodeLine{Mountpoint: system:/error}

\end{DoxyCode}


because the opening of the plugin failed (resulting to a missing backend).

When you are finished you can unmount it with\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{sudo kdb umount /error}

\end{DoxyCode}
 