KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17
System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64
User : nobody ( 99)
PHP Version : 5.2.17
Disable Function : NONE
Directory :  /proc/22697/root/usr/share/gtk-doc/html/libbonobo/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/22697/root/usr/share/gtk-doc/html/libbonobo/libbonobo-bonobo-exception.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>bonobo-exception</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
<link rel="start" href="index.html" title="Libbonobo Reference Manual">
<link rel="up" href="general.html" title="General">
<link rel="prev" href="libbonobo-bonobo-context.html" title="bonobo-context">
<link rel="next" href="libbonobo-bonobo-application.html" title="bonobo-application">
<meta name="generator" content="GTK-Doc V1.7 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="general.html" title="General">
<link rel="chapter" href="factories.html" title="Objects, Factories, Reference Counting">
<link rel="chapter" href="property-bags.html" title="Property Bags, Events, Listeners">
<link rel="chapter" href="monikers.html" title="Monikers">
<link rel="chapter" href="streams.html" title="Storages and Streams">
<link rel="chapter" href="persist.html" title="Persistency">
<link rel="chapter" href="misc.html" title="Miscellaneous">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="libbonobo-bonobo-context.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="general.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">Libbonobo Reference Manual</th>
<td><a accesskey="n" href="libbonobo-bonobo-application.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id2688541" class="shortcut">Top</a>
                  &#160;|&#160;
                  <a href="#id2688845" class="shortcut">Description</a></nobr></td></tr>
</table>
<div class="refentry" lang="en">
<a name="libbonobo-bonobo-exception"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>
<a name="id2688541"></a><span class="refentrytitle">bonobo-exception</span>
</h2>
<p>bonobo-exception &#8212; maps CORBA exceptions to user readable text, + helper macros</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">



#define     <a href="libbonobo-bonobo-exception.html#bonobo-exception-set">bonobo_exception_set</a>            (opt_ev,repo_id)
#define     <a href="libbonobo-bonobo-exception.html#bonobo-return-if-fail">bonobo_return_if_fail</a>           (expr,opt_ev)
#define     <a href="libbonobo-bonobo-exception.html#bonobo-return-val-if-fail">bonobo_return_val_if_fail</a>       (expr,val,opt_ev)
#define     <a href="libbonobo-bonobo-exception.html#BONOBO-EX:CAPS">BONOBO_EX</a>                       (ev)
#define     <a href="libbonobo-bonobo-exception.html#BONOBO-USER-EX:CAPS">BONOBO_USER_EX</a>                  (ev,id)
#define     <a href="libbonobo-bonobo-exception.html#BONOBO-EX-REPOID:CAPS">BONOBO_EX_REPOID</a>                (ev)
#define     <a href="libbonobo-bonobo-exception.html#BONOBO-RET-EX:CAPS">BONOBO_RET_EX</a>                   (ev)
#define     <a href="libbonobo-bonobo-exception.html#BONOBO-RET-VAL-EX:CAPS">BONOBO_RET_VAL_EX</a>               (ev,v)
char*       (<a href="libbonobo-bonobo-exception.html#BonoboExceptionFn">*BonoboExceptionFn</a>)            (CORBA_Environment *ev,
                                             <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"
>gpointer</a> user_data);
char*       <a href="libbonobo-bonobo-exception.html#bonobo-exception-get-text">bonobo_exception_get_text</a>       (CORBA_Environment *ev);
char*       <a href="libbonobo-bonobo-exception.html#bonobo-exception-repoid-to-text">bonobo_exception_repoid_to_text</a> (const char *repo_id);
void        <a href="libbonobo-bonobo-exception.html#bonobo-exception-add-handler-str">bonobo_exception_add_handler_str</a>
                                            (const char *repo_id,
                                             const char *str);
void        <a href="libbonobo-bonobo-exception.html#bonobo-exception-add-handler-fn">bonobo_exception_add_handler_fn</a> (const char *repo_id,
                                             <a href="libbonobo-bonobo-exception.html#BonoboExceptionFn">BonoboExceptionFn</a> fn,
                                             <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"
>gpointer</a> user_data,
                                             <a
href="/usr/share/gtk-doc/html/glib/glib-Datasets.html#GDestroyNotify"
>GDestroyNotify</a> destroy_fn);
void        <a href="libbonobo-bonobo-exception.html#bonobo-exception-general-error-set">bonobo_exception_general_error_set</a>
                                            (CORBA_Environment *ev,
                                             CORBA_TypeCode opt_deriv,
                                             const char *format,
                                             ...);
const char* <a href="libbonobo-bonobo-exception.html#bonobo-exception-general-error-get">bonobo_exception_general_error_get</a>
                                            (CORBA_Environment *ev);
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id2688845"></a><h2>Description</h2>
<p>
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.
</p>
<p>
Typically to test for exceptions the BONOBO_EX macro
is used thus:
  </p>
<div class="example">
<a name="id2688866"></a><p class="title"><b>Example&#160;4.&#160;Bonobo exception trapping and reporting</b></p>
<pre class="programlisting">
int
do_something (CORBA_Environment *ev)
{
	...

	retval = Foo_Baa_method (object, ev);

	if (BONOBO_EX (ev)) {
		if (BONOBO_USER_EX (ev, ex_CosNaming_NamingContext_NotFound)) {
		        g_warning ("Not found");
		} else {
		        char *str;

			g_warning ("Exception '<code class="literal">s</code>' occured",
				(str = bonobo_exception_get_text (ev)));
			g_free (str);
		}
		return -1;
	}
	...
}
     </pre>
</div>
<p>

</p>
</div>
<div class="refsect1" lang="en">
<a name="id2688898"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id2688908"></a><h3>
<a name="bonobo-exception-set"></a>bonobo_exception_set()</h3>
<a class="indexterm" name="id2688921"></a><pre class="programlisting">#define     bonobo_exception_set(opt_ev,repo_id)</pre>
<p>
This macro sets the stateless user exception with <em class="parameter"><code>repo_id</code></em> on
<em class="parameter"><code>opt_ev</code></em> or warns if <em class="parameter"><code>opt_ev</code></em> == NULL
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>opt_ev</code></em>&#160;:</span></td>
<td>an optional corba exception environment.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>repo_id</code></em>&#160;:</span></td>
<td>repoid of the exception to set.


</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2688989"></a><h3>
<a name="bonobo-return-if-fail"></a>bonobo_return_if_fail()</h3>
<a class="indexterm" name="id2689001"></a><pre class="programlisting">#define     bonobo_return_if_fail(expr,opt_ev)</pre>
<p>
this macro is used for bonobo preconditons on argument types,
usualy inside skels if <em class="parameter"><code>expr</code></em> is FALSE a warning is printed and
<em class="parameter"><code>opt_ev</code></em> is set to ex_Bonobo_BadArg.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>expr</code></em>&#160;:</span></td>
<td>an expression that should be true
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>opt_ev</code></em>&#160;:</span></td>
<td>an optional corba exception environment.


</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2689064"></a><h3>
<a name="bonobo-return-val-if-fail"></a>bonobo_return_val_if_fail()</h3>
<a class="indexterm" name="id2689077"></a><pre class="programlisting">#define     bonobo_return_val_if_fail(expr,val,opt_ev)</pre>
<p>
this macro is used for bonobo preconditons on argument types,
usualy inside skels if <em class="parameter"><code>expr</code></em> is FALSE a warning is printed and
<em class="parameter"><code>opt_ev</code></em> is set to ex_Bonobo_BadArg.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>expr</code></em>&#160;:</span></td>
<td>an expression that should be true
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>val</code></em>&#160;:</span></td>
<td>a value to return on failure.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>opt_ev</code></em>&#160;:</span></td>
<td>an optional corba exception environment.


</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2689154"></a><h3>
<a name="BONOBO-EX:CAPS"></a>BONOBO_EX()</h3>
<a class="indexterm" name="id2689167"></a><pre class="programlisting">#define BONOBO_EX(ev)         ((ev) &amp;&amp; (ev)-&gt;_major != CORBA_NO_EXCEPTION)
</pre>
<p>
This macro returns TRUE if <em class="parameter"><code>ev</code></em> flags an exception.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><em class="parameter"><code>ev</code></em>&#160;:</span></td>
<td>the exception environment


</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2689208"></a><h3>
<a name="BONOBO-USER-EX:CAPS"></a>BONOBO_USER_EX()</h3>
<a class="indexterm" name="id2689220"></a><pre class="programlisting">#define     BONOBO_USER_EX(ev,id)</pre>
<p>
This macro returns TRUE if <em class="parameter"><code>ev</code></em> contains a user exception
of type <em class="parameter"><code>id</code></em>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>ev</code></em>&#160;:</span></td>
<td>the exception environment
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>id</code></em>&#160;:</span></td>
<td>the repo_id of the exception


</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2689280"></a><h3>
<a name="BONOBO-EX-REPOID:CAPS"></a>BONOBO_EX_REPOID()</h3>
<a class="indexterm" name="id2689293"></a><pre class="programlisting">#define BONOBO_EX_REPOID(ev)  (ev)-&gt;_id
</pre>
<p>
Returns the repoid string of exception <em class="parameter"><code>ev</code></em>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><em class="parameter"><code>ev</code></em>&#160;:</span></td>
<td>a CORBA exception


</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2689333"></a><h3>
<a name="BONOBO-RET-EX:CAPS"></a>BONOBO_RET_EX()</h3>
<a class="indexterm" name="id2689346"></a><pre class="programlisting">#define     BONOBO_RET_EX(ev)</pre>
<p>
returns if there is an exception flagged in <em class="parameter"><code>ev</code></em>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><em class="parameter"><code>ev</code></em>&#160;:</span></td>
<td>the exception environment


</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2689386"></a><h3>
<a name="BONOBO-RET-VAL-EX:CAPS"></a>BONOBO_RET_VAL_EX()</h3>
<a class="indexterm" name="id2689399"></a><pre class="programlisting">#define     BONOBO_RET_VAL_EX(ev,v)</pre>
<p>
returns <em class="parameter"><code>v</code></em> if there is an exception flagged in <em class="parameter"><code>ev</code></em>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>ev</code></em>&#160;:</span></td>
<td>the exception environment
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>v</code></em>&#160;:</span></td>
<td>the value to return


</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2689458"></a><h3>
<a name="BonoboExceptionFn"></a>BonoboExceptionFn ()</h3>
<a class="indexterm" name="id2689471"></a><pre class="programlisting">char*       (*BonoboExceptionFn)            (CORBA_Environment *ev,
                                             <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"
>gpointer</a> user_data);</pre>
<p>
The prototype for user registerable exception decoders.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>ev</code></em>&#160;:</span></td>
<td>the exception environment
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>user_data</code></em>&#160;:</span></td>
<td>user data to be passed to the function
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td>a g_malloc'd copy of a translated user readable error string.


</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2689551"></a><h3>
<a name="bonobo-exception-get-text"></a>bonobo_exception_get_text ()</h3>
<a class="indexterm" name="id2689565"></a><pre class="programlisting">char*       bonobo_exception_get_text       (CORBA_Environment *ev);</pre>
<p>
Returns a user readable description of the exception.  First
checks <em class="parameter"><code>ev</code></em> against builtin Bonobo exceptions, then falls back to
exception names added through bonobo_exception_add_handler_str
or bonobo_exception_add_handler_fn.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>ev</code></em>&#160;:</span></td>
<td> the corba environment.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> A g_malloc'd description, which the caller must free.
NULL is never returned.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2689635"></a><h3>
<a name="bonobo-exception-repoid-to-text"></a>bonobo_exception_repoid_to_text ()</h3>
<a class="indexterm" name="id2689648"></a><pre class="programlisting">char*       bonobo_exception_repoid_to_text (const char *repo_id);</pre>
<p>
This maps builtin bonobo exceptions that the system
knows about to user readable strings.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>repo_id</code></em>&#160;:</span></td>
<td> exception repository id
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> a user string or NULL for an unknown repo_id
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2689711"></a><h3>
<a name="bonobo-exception-add-handler-str"></a>bonobo_exception_add_handler_str ()</h3>
<a class="indexterm" name="id2689724"></a><pre class="programlisting">void        bonobo_exception_add_handler_str
                                            (const char *repo_id,
                                             const char *str);</pre>
<p>
This routine adds a simple string mapping for an exception
with repository id <em class="parameter"><code>repo_id</code></em>, such that when we call
bonobo_exception_get_text on an exception of id <em class="parameter"><code>repo_id</code></em> we
get <em class="parameter"><code>str</code></em> back.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>repo_id</code></em>&#160;:</span></td>
<td> exception repository id
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>str</code></em>&#160;:</span></td>
<td> the user readable, translated exception text.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2689818"></a><h3>
<a name="bonobo-exception-add-handler-fn"></a>bonobo_exception_add_handler_fn ()</h3>
<a class="indexterm" name="id2689832"></a><pre class="programlisting">void        bonobo_exception_add_handler_fn (const char *repo_id,
                                             <a href="libbonobo-bonobo-exception.html#BonoboExceptionFn">BonoboExceptionFn</a> fn,
                                             <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"
>gpointer</a> user_data,
                                             <a
href="/usr/share/gtk-doc/html/glib/glib-Datasets.html#GDestroyNotify"
>GDestroyNotify</a> destroy_fn);</pre>
<p>
This routine adds a method mapping for an exception
with repository id <em class="parameter"><code>repo_id</code></em>, such that when we call
bonobo_exception_get_text on an exception of id <em class="parameter"><code>repo_id</code></em>
the <em class="parameter"><code>fn</code></em> is called and passed <em class="parameter"><code>user_data</code></em>.
When the handler is removed the <em class="parameter"><code>destroy_fn</code></em> is called
on its <em class="parameter"><code>user_data</code></em>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>repo_id</code></em>&#160;:</span></td>
<td> exception repository id
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>fn</code></em>&#160;:</span></td>
<td> function to make exception human readable
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>user_data</code></em>&#160;:</span></td>
<td> the user data
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>destroy_fn</code></em>&#160;:</span></td>
<td> user data destroy function or NULL.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2689986"></a><h3>
<a name="bonobo-exception-general-error-set"></a>bonobo_exception_general_error_set ()</h3>
<a class="indexterm" name="id2690000"></a><pre class="programlisting">void        bonobo_exception_general_error_set
                                            (CORBA_Environment *ev,
                                             CORBA_TypeCode opt_deriv,
                                             const char *format,
                                             ...);</pre>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>ev</code></em>&#160;:</span></td>
<td>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>opt_deriv</code></em>&#160;:</span></td>
<td>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>format</code></em>&#160;:</span></td>
<td>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>...</code></em>&#160;:</span></td>
<td>


</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2690104"></a><h3>
<a name="bonobo-exception-general-error-get"></a>bonobo_exception_general_error_get ()</h3>
<a class="indexterm" name="id2690118"></a><pre class="programlisting">const char* bonobo_exception_general_error_get
                                            (CORBA_Environment *ev);</pre>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>ev</code></em>&#160;:</span></td>
<td>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td>


</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
</body>
</html>

Anon7 - 2021