Bonobo API Reference Manual | |||
---|---|---|---|
<<< Previous Page | Home | Up | Next Page >>> |
#define BONOBO_EX (ev) #define BONOBO_USER_EX (ev,id) #define BONOBO_RET_EX (ev) #define BONOBO_RET_VAL_EX (ev,v) char* (*BonoboExceptionFn) (CORBA_Environment *ev, gpointer user_data); #define bonobo_return_if_fail (expr,opt_ev) #define bonobo_return_val_if_fail (expr,val,opt_ev) #define bonobo_exception_set (opt_ev,repo_id) char* bonobo_exception_get_text (CORBA_Environment *ev); void bonobo_exception_add_handler_str (const char *repo_id, const char *str); void bonobo_exception_add_handler_fn (const char *repo_id, BonoboExceptionFn fn, gpointer user_data, GDestroyNotify destroy_fn); char* bonobo_exception_repoid_to_text (const char *repo_id); |
This module contains some useful helper functions that can be used to set various exceptions inside your CORBA methods. It also contains code to map between complex CORBA_Environment exceptions and helpful strings suitable for display to the user.
Typically to test for exceptions the BONOBO_EX macro is used thus:
char* bonobo_exception_get_text (CORBA_Environment *ev); |
Returns a user readable description of the exception. First checks ev against builtin Bonobo exceptions, then falls back to exception names added through bonobo_exception_add_handler_str or bonobo_exception_add_handler_fn.
void bonobo_exception_add_handler_str (const char *repo_id, const char *str); |
This routine adds a simple string mapping for an exception with repository id repo_id, such that when we call bonobo_exception_get_text on an exception of id repo_id we get str back.
void bonobo_exception_add_handler_fn (const char *repo_id, BonoboExceptionFn fn, gpointer user_data, GDestroyNotify destroy_fn); |
This routine adds a method mapping for an exception with repository id repo_id, such that when we call bonobo_exception_get_text on an exception of id repo_id the fn is called and passed user_data. When the handler is removed the destroy_fn is called on its user_data.