thufir wrote:
> On Fri, 09 May 2008 07:55:17 -0700, Daniel Pitts wrote:
>
>>> The makeGuest is working fine, probably because the data is fine. If
>>> the constructor of Guest throws a DataException, though, I wouldn't
>>> want makeGuest to return a new Guest! I'm not quite sure what it
>>> should do, if not that, though...
>>>
>>> Should I try makeGuest first? Would it make sense to have a
>>> tryMakeGuest () method?
>> Just don't catch the exception in makeGuest. Let it propagate up to
>> whoever calls makeGuest.
>
>
> I'll take another look at it, but I think that I was getting a compile
> error, uncaught exception, when I tried that.
Sounds like the exception was not caught by the invoker of the method,
then.
The method itself has to declare any checked exceptions it throws, or the
rethrow will fail.
--
Lew


|