[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to detect failed login?



On Tue, 12 Oct 1999, you wrote:
> Yes, I can see why it doesn't check.  But the real problem I am seeing is the fact
> that the proxy is throwing an exception *nothing* can catch.  I have exception
> handling everywhere and it still crashes my program.  I could be somewhat
> premptive if there were a db.isConnected() or maybe a
> isConnected(RemoteDatabase)    call I could use to see if a connection exists.

1) A method to check if the client is actually connected to the server would be
ok but because it _is_ an exception, if no server is present, the method should
throw an Exception.

2) The top-level exception you get is DE.softwarebuero.ozone.UnexpectedError
(now org.ozoneDB.UnexpectedError ;) This is not an exception but you _can_ catch
it by catching Error or even Throwable.

3) Catching Error is not a good idea in general. An Error "indicates
serious problems that a reasonable application should not try to catch. Most
such errors are abnormal conditions.".

ozone signals with UnexpectedError that an exception was caught that is not in
the throws clause of the method. In your case, Tim, the method does not
have a throws clause (right?) but a PermissionDeniedExc is thrown and so ozone
wraps it in the UnexpectedError. You can simply add Exception to the throws
clause of the method to avoid this problem without catching Error - but ...

4) ... this is probably not what you want. The best solution would be
to change UnexpectedError to extend RuntimeException not Error!
RuntimeExceptions can be simply catched as Exceptions _and_ can be thrown
without mentioned in the throws clause.

--> I have to change this in ozone. Other ideas?


Falko
-- 
______________________________________________________________________
Falko Braeutigam                         mailto:falko@softwarebuero.de
softwarebuero m&b (SMB)                    http://www.softwarebuero.de