To set an exception value in the caller's Environment structure, a method implementation makes a call to the somSetException procedure:
void somSetException ( Environment *ev, exception_type major, string exception_name, void *params);
where "ev" is a pointer to the Environment structure passed to the method, "major" is an exception_type, "exception_name" is the string name of the exception (usually the constant defined by the IDL compiler, for example, ex_BAD_FLAG), and "params" is a pointer to an (initialized) exception structure which must be allocated by SOMMalloc:
typedef enum exception_type { NO_EXCEPTION, USER_EXCEPTION, SYSTEM_EXCEPTION } exception_type;
It is important to reiterate that somSetException expects the params argument to be a pointer to a structure that was allocated using SOMMalloc. When somSetException is called, the client passes ownership of the exception structure to the SOM run-time environment. The SOM run-time environment will free the structure when the exception is reset (that is, upon the next call to somSetException), or when the somExceptionFree procedure is called.
Note that somSetException simply sets the exception value; it performs no exit processing. If there are multiple calls to somSetException before the method returns, the caller will only see the last exception value.