5 #include <glib/gi18n-lib.h>
7 #include "e-book-contacts-types.h"
9 G_DEFINE_QUARK (e-book-client-error-quark, e_book_client_error)
12 * e_book_client_error_to_string:
19 e_book_client_error_to_string (EBookClientError code)
22 case E_BOOK_CLIENT_ERROR_NO_SUCH_BOOK:
23 return _("No such book");
24 case E_BOOK_CLIENT_ERROR_CONTACT_NOT_FOUND:
25 return _("Contact not found");
26 case E_BOOK_CLIENT_ERROR_CONTACT_ID_ALREADY_EXISTS:
27 return _("Contact ID already exists");
28 case E_BOOK_CLIENT_ERROR_NO_SUCH_SOURCE:
29 return _("No such source");
30 case E_BOOK_CLIENT_ERROR_NO_SPACE:
34 return _("Unknown error");
38 * e_book_client_error_create:
39 * @code: an #EBookClientError code to create
40 * @custom_msg: custom message to use for the error; can be %NULL
42 * Returns: a new #GError containing an E_BOOK_CLIENT_ERROR of the given
43 * @code. If the @custom_msg is NULL, then the error message is
44 * the one returned from e_book_client_error_to_string() for the @code,
45 * otherwise the given message is used.
47 * Returned pointer should be freed with g_error_free().
51 * Deprecated: 3.8: Just use the #GError API directly.
54 e_book_client_error_create (EBookClientError code,
55 const gchar *custom_msg)
57 return g_error_new_literal (E_BOOK_CLIENT_ERROR, code, custom_msg ? custom_msg : e_book_client_error_to_string (code));