Re: How to handle exceptions in constructor?
- From: Stefan Schulz <terra@xxxxxxxxxxxx>
- Date: Mon, 27 Jun 2005 20:21:39 +0200
On Mon, 27 Jun 2005 03:18:40 +0000, George George via JavaKB.com wrote:
> I think we should throw the exception to let the invoker know that the
> instance of the object has not been created successfully, so that the invoker
> can peform appropriate actions. But I am not quite sure whether I am correct
> since I have not seen any constructors which throw exceptions before.
>
> Could anyone help?
You absolutely should pass the exception through, or at least throw
another, if your object could not be successfully constructed. A
constructor can throw Exceptions just like any other method
--
You can't run away forever,
But there's nothing wrong with getting a good head start.
--- Jim Steinman, "Rock and Roll Dreams Come Through"
.
- Follow-Ups:
- Re: How to handle exceptions in constructor?
- From: George George via JavaKB.com
- Re: How to handle exceptions in constructor?
- References:
- How to handle exceptions in constructor?
- From: George George via JavaKB.com
- How to handle exceptions in constructor?
- Prev by Date: Re: File chooser question
- Next by Date: Re: formatting floats in a table
- Previous by thread: Re: How to handle exceptions in constructor?
- Next by thread: Re: How to handle exceptions in constructor?
- Index(es):
Relevant Pages
|