## Set error and warning handlers

There are several other callback handlers that can be set on serializers. These can be set any time before serializing is started. Errors and warnings from serializing can be returned with functions that all take a callback of type raptor_message_handler and signature:

    void
    message_handler(void *user_data, raptor_locator* locator,
                    const char *message)
    {
      /* do something with the message */
    }

returning the user data given, associated location information as a raptor_locator and the error/warning message itself. The locator structure contains full information on the details of where in the serialized file or URI the message occurred.

The fatal error, error and warning handlers are all set with similar functions that take a handler as follows:

      raptor_serializer_set_error_handler(rdf_serializer, user_data, error_handler);

      raptor_serializer_set_warning_handler(rdf_serializer, user_data, warning_handler);