User Exceptions Requirements
----------------------------
< Document unfinished - see printed version on Greg's desk>
We should additonally use a standard exception pattern employing exception translation. It
should also accomodate exception chaining. 

The basic constructors for each exception should be inherited, so each exception we defined
doesn't need all constructors.

Each user exception should defined a unique error message - such as that in a VMS message
(.msg) file.

Error message issuance should be integrated with a user exception's constructor (optionally),
so the throw() operation is the same as issuing the error.

Should be easy to extend it in the next round to using the event service to send errors to 
log servant and display heads.

Should be easy to extend it in the next round to put the constant message text in the db, or
in a ResourceBundle (though that's not compatible with c++).


module name
{
	exception nameException // Exception must be defined in module or interface scope.
	{
		string suppl;
	}; 
	
	interface NameI
	{
		long getService( in string name ) raises (nameException);
		long getSource( in string name, out string suppl );
	};
};

gives the following. Note that ex.getMessage() will not return suppl, but
nameExceptionHelper.id() + _reason. You can't put operations in CORBA exceptions
and hence override getMessage, so you just have to access the suppl text with ex.suppl!

final public class nameException extends org.omg.CORBA.UserException
{
    public
    nameException()
    {
        super(nameExceptionHelper.id());
    }

    public
    nameException(String suppl)
    {
        super(nameExceptionHelper.id());
        this.suppl = suppl;
    }

    public
    nameException(String _reason,
                  String suppl)
    {
        super(nameExceptionHelper.id() + " " + _reason);
        this.suppl = suppl;
    }

    public String suppl;
}


      try {
          org.omg.CORBA.Any anyVal = orb.create_any();
          double fval = 0.0;
          String mn;
          
          mn = "PEP3.Luminosity";	// shouldn't be found
          anyVal = dai.get( mn );
          fval = (float)anyVal.extract_float();
          System.out.println( mn + " = " + fval );
      }
      catch ( daException e) {
          System.err.println("Caught daException: " + e.suppl);
      }


SERVER SIDE
-----------

public abstract class AidaException extends java.lang.Exception {

   private String message_;  // The message text
   private String suppl_;    // Supplementary text
   private boolean issued_;
   
    /**
     * Constructs an AidaException with the specified detail message.
     * @param msg the detail message.
     */
    public AidaException(String message) {
        super(message);
        message_ = message;
        issued_ = false;
    }
    
     public AidaException( String message, boolean issue) {
        super(message);
        message_ = message;
        if (issue) System.err.println(message_);
        issued_ = issue;
    }  
    
    public AidaException(String message, String suppl, boolean issue) {
        super(message);
        message_ = message;
        suppl_ = suppl;
        if (issue) System.err.println( message_ + "\nSuppl: " + suppl_ );
        issued_ = issue;
    }
}


in Name_impl.java, exception translate all exceptions to nameException

	public int
            getService(String name) throws nameException
	{
            try {
		return Name.getService( name );
            } catch ( Exception e ) {
                throw new nameException( e.getMessage() );
            }
	}


Eg, in Name.java, getService() method

try {
    sql to do acquisitionof service name
} catch (SQLException e) {
    throw new NoMatchingService( lname, "", e.getMessage );
}


Checked Exceptions
    If a method chooses not to catch an exception it must document that it throws the exception. 
    Thus all of the exceptions that may be thrown by the method are part of the method's 
    interface. These are the checked exceptions. In general, checked exceptions are the antiset
    of Runtime Exceptions.