## Managing errors

Errors are a special kind of event which the GdaConnection object generates. You can manage errors with GdaConnectionEvent class and obtain them with function gda_connection_get_events() so let's see them and an example:

Here you see the functions to manage errors:

- gda_connection_event_get_description()

- gda_connection_event_get_gda_code()

- gda_connection_event_get_code()

- gda_connection_event_get_source()

- gda_connection_event_get_sqlstate()

Here you can see an example of using this:

          gboolean
          get_errors (GdaConnection *connection)
          {
            GList *list;
            GList *node;
            GdaConnectionEvent *error;

            list = (GList *) gda_connection_get_events (connection);

            for (node = g_list_first (list); node != NULL; node = g_list_next (node))
              {
                error = (GdaConnectionEvent *) node->data;
                g_print ("GDA error no: %d\t", gda_connection_event_get_code (error));
                g_print ("Provider specific error no: %d\t", gda_connection_event_get_code (error));
                g_print ("desc: %s\t", gda_connection_event_get_description (error));
                g_print ("source: %s\t", gda_connection_event_get_source (error));
                g_print ("sqlstate: %s\n", gda_connection_event_get_sqlstate (error));
              }
          }

| Obtains errors list.
| Loop for getting error information.