| Camel Reference Manual | ||||
|---|---|---|---|---|
enum ExceptionId; struct CamelException; #define CAMEL_EXCEPTION_INITIALISER CamelException* camel_exception_new (void);void camel_exception_free (CamelException *ex);void camel_exception_init (CamelException *ex);void camel_exception_clear (CamelException *ex);void camel_exception_set (CamelException *ex, ExceptionId id, constchar *desc);void camel_exception_setv (CamelException *ex, ExceptionId id, constchar *format, ...);void camel_exception_xfer (CamelException *ex_dst, CamelException *ex_src); ExceptionId camel_exception_get_id (CamelException *ex); constchar * camel_exception_get_description (CamelException *ex); #define camel_exception_is_set (ex)
struct CamelException {
/* do not access the fields directly */
ExceptionId id;
char *desc;
};
CamelException* camel_exception_new (void);
Create and returns a new exception object.
| Returns : | the newly allocated exception object |
void camel_exception_free (CamelException *ex);
Free an exception object. If the exception is NULL
ex : |
a CamelException |
void camel_exception_init (CamelException *ex);
Init an exception. This routine is mainly useful when using a statically allocated exception.
ex : |
a CamelException |
void camel_exception_clear (CamelException *ex);
Clear an exception, that is, set the exception ID to
NULL
ex : |
a CamelException |
void camel_exception_set (CamelException *ex, ExceptionId id, constchar *desc);
Set the value of an exception. The exception id is a unique number representing the exception. The textual description is a small text explaining what happened and provoked the exception.
When ex is NULL
ex : |
a CamelException |
id : |
exception id |
desc : |
textual description of the exception |
void camel_exception_setv (CamelException *ex, ExceptionId id, constchar *format, ...);
Set the value of an exception. The exception id is a unique number representing the exception. The textual description is a small text explaining what happened and provoked the exception. In this version, the string is created from the format string and the variable argument list.
It is safe to say: camel_exception_setv (ex, ..., camel_exception_get_description (ex), ...);
When ex is NULL
ex : |
a CamelException |
id : |
exception id |
format : |
format of the description string. The format string is
used as in printf() |
... : |
void camel_exception_xfer (CamelException *ex_dst, CamelException *ex_src);
Transfer the content of an exception from an exception object to another. The destination exception receives the id and the description text of the source exception.
ex_dst : |
Destination exception object |
ex_src : |
Source exception object |
ExceptionId camel_exception_get_id (CamelException *ex);
Get the id of an exception.
ex : |
a CamelException |
| Returns : | the exception id (ex is NULL |
constchar * camel_exception_get_description (CamelException *ex);
Get the exception description text.
ex : |
a CamelException |
| Returns : | the exception description text (NULLex is NULL |