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:
Example 1. Bonobo exception trapping and reporting
The prototype for user registerable exception decoders.
ev :
the exception environment
user_data :
user data to be passed to the function
Returns :
a g_malloc'd copy of a translated user readable error string.
bonobo_return_if_fail()
#define bonobo_return_if_fail(expr,opt_ev)
this macro is used for bonobo preconditons on argument types,
usualy inside skels if expr is FALSE a warning is printed and
opt_ev is set to ex_Bonobo_BadArg.
this macro is used for bonobo preconditons on argument types,
usualy inside skels if expr is FALSE a warning is printed and
opt_ev is set to ex_Bonobo_BadArg.
expr :
an expression that should be true
val :
a value to return on failure.
opt_ev :
an optional corba exception environment.
bonobo_exception_set()
#define bonobo_exception_set(opt_ev,repo_id)
This macro sets the stateless user exception with repo_id on
opt_ev or warns if opt_ev == NULL
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.
ev :
the corba environment.
Returns :
A g_malloc'd description, which the caller must free.
NULL is never returned.
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.
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.