+/*!
+@name Error API
+@{
+*/
+
+/*!
+@brief
+ Parsing error type, as returned by
+ \link argpar_error_type(const argpar_error_t *) argpar_error_type()\endlink.
+*/
+typedef enum argpar_error_type {
+ /// Unknown option error
+ ARGPAR_ERROR_TYPE_UNKNOWN_OPT,
+
+ /// Missing option argument error
+ ARGPAR_ERROR_TYPE_MISSING_OPT_ARG,
+
+ /// Unexpected option argument error
+ ARGPAR_ERROR_TYPE_UNEXPECTED_OPT_ARG,
+} argpar_error_type_t;
+
+/*!
+@struct argpar_error
+
+@brief
+ Opaque parsing error type
+*/
+typedef struct argpar_error argpar_error_t;
+
+/*!
+@brief
+ Returns the type of the parsing error object \p error.
+
+@param[in] error
+ Parsing error of which to get the type.
+
+@returns
+ Type of \p error.
+
+@pre
+ \p error is not \c NULL.
+*/
+/// @cond hidden_macro
+ARGPAR_HIDDEN
+/// @endcond
+argpar_error_type_t argpar_error_type(
+ const argpar_error_t *error) ARGPAR_NOEXCEPT;
+
+/*!
+@brief
+ Returns the index of the original argument (in \p argv, as passed to
+ argpar_iter_create()) for which the parsing error described by
+ \p error occurred.
+
+@param[in] error
+ Parsing error of which to get the original argument index.
+
+@returns
+ Original argument index of \p error.
+
+@pre
+ \p error is not \c NULL.
+*/
+/// @cond hidden_macro
+ARGPAR_HIDDEN
+/// @endcond
+unsigned int argpar_error_orig_index(
+ const argpar_error_t *error) ARGPAR_NOEXCEPT;
+
+/*!
+@brief
+ Returns the name of the unknown option for which the parsing error
+ described by \p error occurred.
+
+The returned name includes any <code>-</code> or <code>\--</code>
+prefix.
+
+With the long option with argument form, for example
+<code>\--mireille=deyglun</code>, this function only returns the name
+part (<code>\--mireille</code> in the last example).
+
+@param[in] error
+ Parsing error of which to get the name of the unknown option.
+
+@returns
+ Name of the unknown option of \p error.
+
+@pre
+ \p error is not \c NULL.
+@pre
+ The type of \p error, as returned by
+ \link argpar_error_type(const argpar_error_t *) argpar_error_type()\endlink,
+ is #ARGPAR_ERROR_TYPE_UNKNOWN_OPT.
+*/
+/// @cond hidden_macro
+ARGPAR_HIDDEN
+/// @endcond
+const char *argpar_error_unknown_opt_name(
+ const argpar_error_t *error) ARGPAR_NOEXCEPT;
+
+/*!
+@brief
+ Returns the descriptor of the option for which the parsing error
+ described by \p error occurred.
+
+@param[in] error
+ Parsing error of which to get the option descriptor.
+@param[out] is_short
+ @parblock
+ If not \c NULL, this function sets \p *is_short to:
+
+ - \c true if the option for which \p error occurred is a short
+ option.
+
+ - \c false if the option for which \p error occurred is a long
+ option.
+ @endparblock
+
+@returns
+ Descriptor of the option of \p error.
+
+@pre
+ \p error is not \c NULL.
+@pre
+ The type of \p error, as returned by
+ \link argpar_error_type(const argpar_error_t *) argpar_error_type()\endlink,
+ is #ARGPAR_ERROR_TYPE_MISSING_OPT_ARG or
+ #ARGPAR_ERROR_TYPE_UNEXPECTED_OPT_ARG.
+*/
+/// @cond hidden_macro
+ARGPAR_HIDDEN
+/// @endcond
+const argpar_opt_descr_t *argpar_error_opt_descr(const argpar_error_t *error,
+ bool *is_short) ARGPAR_NOEXCEPT;
+
+/*!
+@brief
+ Destroys the parsing error \p error.
+
+@param[in] error
+ Parsing error to destroy (may be \c NULL).
+*/
+/// @cond hidden_macro
+ARGPAR_HIDDEN
+/// @endcond
+void argpar_error_destroy(const argpar_error_t *error) ARGPAR_NOEXCEPT;
+
+/// @}
+