# XQilla XQC API Documentation

# XQC_ErrorHandler_s Struct Reference

The XQC_ErrorHandler struct is designed to be populated by users for the purpose of collecting more detailed error messages from an XQC implementation. More...

`#include <xqc.h>`

List of all members.

## Public Attributes

void * | user_data
| Can be used for user specific purposes.
void(* | error )(XQC_ErrorHandler *handler, XQC_Error error, const char *error_uri, const char *error_localname, const char *description, XQC_Sequence *error_object)
| The function called when an error occurs.

## Detailed Description

The XQC_ErrorHandler struct is designed to be populated by users for the purpose of collecting more detailed error messages from an XQC implementation.

An XQC_ErrorHandler can be set for a query execution using the XQC_StaticContext::set_error_handler() and XQC_DynamicContext::set_error_handler() functions.

The XQC_ErrorHandler struct has no free() function pointer because the user remains responsible for freeing the resources associated with this struct.

## Member Data Documentation

void(* XQC_ErrorHandler_s::error)(XQC_ErrorHandler *handler, XQC_Error error, const char *error_uri, const char *error_localname, const char *description, XQC_Sequence *error_object)

The function called when an error occurs.

The function receives the components of the error as arguments. When this function returns, the implementation will exit query preparation or execution with the error enumeration value passed as an argument.

Parameters:

  | handler | The XQC_ErrorHandler that this function pointer is a member of
  | error | An enumeration value representing the type of error. One of either XQC_STATIC_ERROR, XQC_TYPE_ERROR, XQC_DYNAMIC_ERROR, or XQC_SERIALIZATION_ERROR.
  | error_uri | The namespace URI of the error code QName as a UTF-8 string, or 0 if there is no namespace URI.
  | error_localname | The local name of the error code QName as a UTF-8 string.
  | description | The description of the error message as a UTF-8 string. The description may be absent, in which case this parameter will be 0.
  | error_object | The error object, potentially passed to the `fn:error()` function. The user owns this object, and is responsible for freeing it. The error_object may be absent, in which case this parameter will be 0. Some implementations may not provide this functionality, meaning that this parameter will always be 0.

void* XQC_ErrorHandler_s::user_data

Can be used for user specific purposes.

The documentation for this struct was generated from the following file:

- xqc.h