OSF DCE Application Development Guide--Core Components

Topics in RPC Application Development
You can use a simpler coding style.
Exceptions work well for coarse-grained exception handling.
If your application does not contain any exception handlers and the application
thread gets an error, the application thread is terminated and a system-dependent
error message from the threads package is printed.
Note: RPC exceptions are equivalent to RPC status codes. To identify the status
code that corresponds to a given exception, replace the _x_ string of the
exception with the string _s_. For example, the exception
rpc_x_comm_failure is equivalent to the status code
rpc_s_comm_failure. The RPC exceptions are defined in the
dce/rpcexc.h header file, and the equivalent status codes are described in
the
The set of exceptions that can always be returned from the server to the client (such as
the rpc_x_invalid_tag exception) are referred to as system exceptions. These exceptions
are defined in dce/rpcexec.h and dce/exec_handling.h.
An interface definition can also specify a set of user-defined exceptions that the
interface’s operations can return to the client. You can declare user-defined exceptions
in an interface definition by using the exceptions interface attribute, which is described
in Chapter 17.
If a user-defined exception in the implementation of a server operation occurs during
server execution, the server terminates the operation and propagates the exception to the
client in a manner similar to the way system exceptions are propagated. If a server
implementation of an operation raises an exception that is neither a system exception nor
a user-defined exception, the exception returned to the client is
rpc_x_unknown_remote_fault.
By default, the IDL compiler defines and initializes all exceptions under a ‘‘once block’’
in the generated stubs. If you want to share exception names in multiple interfaces or
you desire greater control over how these exceptions are defined and initialized, you can
use the ACF extern_exceptions attribute to disable the automated mechanism that the
IDL compiler uses to define and initialize exceptions. See Chapter 18 for more
information on the extern_exceptions attribute.
Because exceptions are associated with operation implementation, they are not imported
into other interfaces by way of the import declaration. For more information about
using exceptions to handle errors, see Part 2 of this guide.
16.2.2 The fault_status Attribute
The fault_status attribute requests that errors occurring on the server due to incorrectly
specified parameter values, resource constraints, or coding errors be reported by a
designated status parameter instead of by an exception.
If a user-defined exception is returned from a server to a client that has specified
fault_status on the operation in which the exception occurred, the value given to the
fault_status parameter is rpc_s_fault_user_defined.
124245 Tandem Computers Incorporated 167