midgard/midgard_error.h

00001 /* 
00002  * Copyright (C) 2006 Piotr Pokora <piotr.pokora@infoglob.pl>
00003  *
00004  * This program is free software; you can redistribute it and/or modify it
00005  * under the terms of the GNU Lesser General Public License as published
00006  * by the Free Software Foundation; either version 2 of the License, or
00007  * (at your option) any later version.
00008  * 
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  * 
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017  */
00018 
00019 #ifndef MIDGARD_ERROR_H
00020 #define MIDGARD_ERROR_H
00021 
00022 #include "midgard/midgard_connection.h"
00023 
00024 G_BEGIN_DECLS
00025 
00031 #define MGD_GENERIC_ERROR midgard_error_generic()
00032 
00041 typedef enum
00042 {
00043         MGD_ERR_OK = -0, 
00044         MGD_ERR_ERROR = -1, 
00045         MGD_ERR_ACCESS_DENIED = -2, 
00046         MGD_ERR_SITEGROUP_VIOLATION = -3, 
00047         MGD_ERR_NOT_OBJECT = -4, 
00048         MGD_ERR_NOT_EXISTS = -5, 
00049         MGD_ERR_NO_MEM = -6 , 
00050         MGD_ERR_INVALID_NAME = -7 , 
00051         MGD_ERR_DUPLICATE = -8 , 
00052         MGD_ERR_HAS_DEPENDANTS = -9 , 
00053         MGD_ERR_RANGE = -10, 
00054         MGD_ERR_NOT_CONNECTED = -11, 
00055         MGD_ERR_SG_NOTFOUND = -12, 
00056         MGD_ERR_INVALID_OBJECT = -13, 
00057         MGD_ERR_QUOTA = -14, 
00058         MGD_ERR_INTERNAL = -15, 
00059         MGD_ERR_OBJECT_NAME_EXISTS = -16, 
00060         MGD_ERR_OBJECT_NO_STORAGE = -17, 
00061         MGD_ERR_OBJECT_NO_PARENT= -18, 
00062         MGD_ERR_INVALID_PROPERTY_VALUE = -19, 
00063         MGD_ERR_USER_DATA = -20, 
00064         MGD_ERR_OBJECT_DELETED = -21, 
00065         MGD_ERR_OBJECT_PURGED = -22, 
00066         MGD_ERR_OBJECT_EXPORTED = -23, 
00067         MGD_ERR_OBJECT_IMPORTED = -24, 
00068         MGD_ERR_MISSED_DEPENDENCE = -25 
00069 }MgdErrorGeneric;
00070 
00079 extern GQuark midgard_error_generic(void);
00080 
00091 extern const gchar *midgard_error_string(GQuark domain, gint errcode);
00092 
00123 extern void midgard_set_error(
00124                 MidgardConnection *mgd, GQuark domain, 
00125                 gint errcode, const gchar *msg, ...);
00126 
00135 #define MIDGARD_ERRNO_SET(str, errcode)  \
00136         str->errn = errcode; \
00137         midgard_set_error(str->_mgd, \
00138         MGD_GENERIC_ERROR, \
00139         errcode, \
00140         NULL); \
00141         g_clear_error(&str->_mgd->err);
00142 
00143 G_END_DECLS
00144 
00145 #endif /* MIDGARD_ERROR_H */

Generated on Thu Feb 22 06:15:14 2007 for midgard-core by  doxygen 1.4.6