|
Posted by Torgny Bjers on 08/05/05 14:11
Norbert Wenzel wrote:
> If there is a class with a function, that might throw exceptions and
> does NOT catch them, may I write that like in Java?
>
> class FooClass {
>
> public function foo() throws Exception {
>
> }
>
> }
>
> Or is there another possibility to tell a function throws an exception
> and to force the caller to handle that exception?
>
> thanks in advance,
>
> Norbert
>
Hello Norbert,
The Java way doesn't work here. The best approach would be to simply run
a try/catch/finally around the call to your function/method, and inside
the function itself you do the following:
if (...) { throw new Exception("My message."); } }
Regards,
Torgny
Navigation:
[Reply to this message]
|