Yes, it can be.
It can be anywhere as long as the exception message provides the required
information (component type, path in page, some info about its model, etc.).

IMO adding such kind of code to any of the methods in the API will lead to
further tickets about adding similar code to other methods too.

The code snippet looks like a noise to me. But others find it useful. So I
ask for more opinions whether we want to go this road.


Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Mon, Dec 15, 2014 at 10:57 AM, Ernesto Reinaldo Barreiro <
[email protected]> wrote:
>
> Can't this wrapping be done on the code that calls detach?
>
> On Mon, Dec 15, 2014 at 8:41 AM, Martin Grigorov <[email protected]>
> wrote:
> >
> > Hi,
> >
> > https://issues.apache.org/jira/browse/WICKET-5776 suggests to try/catch
> > and
> > wrap exceptions in Component#detach() so that it is easier for the
> > application developer to identify the problematic component.
> > The reporter suggests code like:
> >
> > void detach() {
> >   try {
> >     // detachChildren  } catch (ComponentDetachException cde) {
> >     throw cde;
> >   } catch (Exception e) {
> >     throw new ComponentDetachException("Error detaching component " +
> > getPath() +
> >       (getDefaultModel() != null ? " with a " +
> > getDefaultModel().getClass().getName() + " model" : "") + ": " + e,
> > e);
> >   }
> > }
> >
> >
> > In a comment in the ticket I explain my concerns.
> >
> > What do you think about this suggestion ?
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
> >
>
>
> --
> Regards - Ernesto Reinaldo Barreiro
>

Reply via email to