Ive spent time debugging issues similar to this - errors in onDetach can be very hard to diagnose even when you can reliably reproduce the issue in the webapp. Once youve done it a couple of times, you start to check for things like this when you start diagnosing new issues, but for newcomers to the platform, I can certainly see the frustration. Perhaps we could use a ThreadLocal during rendering to store such errors?
On Mon, Dec 15, 2014 at 4:05 AM, Martin Grigorov <[email protected]> wrote: > 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 > > >
