So for something like below, should i be throwing a InternalErrorException?
Where is the InternalErrorException class?

  private static void checkPermissions(File file) {
       if (!file.canRead())
           throw new RuntimeException("The file " + file.getAbsolutePath()
+ " does not have read permissions.  Please add read permission");
       if (!file.canWrite()) {
           throw new RuntimeException("The file " + file.getAbsolutePath()
+ " does not have write permissions.  Please add write permission");
       }

   }

On 1/12/07, Alan D. Cabrera <[EMAIL PROTECTED]> wrote:


On Jan 5, 2007, at 9:35 AM, Dain Sundstrom wrote:

> On Jan 5, 2007, at 9:23 AM, Alan D. Cabrera wrote:
>
>> We throw a number of vanilla RuntimeExceptions.  Should we not
>> build a few OpenEJB exceptions on top of these?
>
> I agree that vanilla RuntimeExceptions are bad, but I think we
> should be careful when replacing these.  In general, I think we
> should favor the standard Java exception classes like NullPointer,
> IllegalArgument, and IllegalState.  I hope we can avoid the
> coupling that happened in Geronimo when we had lots of "common"
> exceptions in the geronimo-common module.

Agreed.  Useful and informative runtime exceptions should be left as
is.  But, I also think that we should wrap exceptions that would make
no sense to the bean developer.  For example, when calling a session
context getBusinessObject, that method could theoretically throw an
IllegalAccessException when it returns a proxy to the business
object.  I think that it should be wrapped with another runtime
exception such as InternalErrorException.


Regards,
Alan







--
Karan Malhi

Reply via email to