You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Jayakrishnan R <jk...@gmail.com> on 2013/02/20 16:51:29 UTC

Wicket LoadableDetachableModel exception handling issue

In my project, I am using LoadableDetachableModel as given below.

public ReportPage(final Objectm, final PageReference pr) throws
CustomException{try{final LoadableDetachableModel<List<MaintReport>>
ldm =
         new LoadableDetachableModel<List<MaintReport>>() {

            @Override
            protected List<MaintReport>load() {
                **// Some Database operations //**
                return x;
            }
        };
/*
Several LoadableDetachableModels, PageableListViews, Panels, Fragments  etc.
*/ } catch ( Exception ex){// create Custom Exception } finally {
 // Clean up of stuff }


My problem is that I am using AbstractColumn to display the objects in the
column and the overriden populateItem() method calls the load()
internally.  Since both the methods cannot throw Exceptions, I cannot
really catch exceptions and display appropriate messages.

Any help on this is really appreciated.

-- 
Thanks & Regards
JK

Re: Wicket LoadableDetachableModel exception handling issue

Posted by Ondrej Zizka <oz...@redhat.com>.
Actually I think Wicket offers, inherently, one of the best ways to 
handle exceptions - I can catch it wherever I want, rewrap, redirect, 
ignore, alter the model...  I haven't seen such freedom and versatility 
in any other web framework.
YMMV.

Ondra


On 02/20/2013 05:39 PM, Jayakrishnan R wrote:
>
> i have already done that as a back up plan.  Do you think wicket is a 
> bit wierd in handling exceptions.
>
> On 20 Feb 2013 16:22, "Ondrej Zizka" <ozizka@redhat.com 
> <ma...@redhat.com>> wrote:
>
>     How about wrapping it to a RuntimeException, or preferably, your
>     own subclass of it?
>
>     Ondra
>
>
>
>     On 02/20/2013 04:51 PM, Jayakrishnan R wrote:
>
>         In my project, I am using LoadableDetachableModel as given below.
>
>         public ReportPage(final Objectm, final PageReference pr) throws
>         CustomException{try{final
>         LoadableDetachableModel<List<MaintReport>>
>         ldm =
>                   new LoadableDetachableModel<List<MaintReport>>() {
>
>                      @Override
>                      protected List<MaintReport>load() {
>                          **// Some Database operations //**
>                          return x;
>                      }
>                  };
>         /*
>         Several LoadableDetachableModels, PageableListViews, Panels,
>         Fragments  etc.
>         */ } catch ( Exception ex){// create Custom Exception } finally {
>           // Clean up of stuff }
>
>
>         My problem is that I am using AbstractColumn to display the
>         objects in the
>         column and the overriden populateItem() method calls the load()
>         internally.  Since both the methods cannot throw Exceptions, I
>         cannot
>         really catch exceptions and display appropriate messages.
>
>         Any help on this is really appreciated.
>
>


Re: Wicket LoadableDetachableModel exception handling issue

Posted by Jayakrishnan R <jk...@gmail.com>.
i have already done that as a back up plan.  Do you think wicket is a bit
wierd in handling exceptions.
On 20 Feb 2013 16:22, "Ondrej Zizka" <oz...@redhat.com> wrote:

> How about wrapping it to a RuntimeException, or preferably, your own
> subclass of it?
>
> Ondra
>
>
>
> On 02/20/2013 04:51 PM, Jayakrishnan R wrote:
>
>> In my project, I am using LoadableDetachableModel as given below.
>>
>> public ReportPage(final Objectm, final PageReference pr) throws
>> CustomException{try{final LoadableDetachableModel<List<**MaintReport>>
>> ldm =
>>           new LoadableDetachableModel<List<**MaintReport>>() {
>>
>>              @Override
>>              protected List<MaintReport>load() {
>>                  **// Some Database operations //**
>>                  return x;
>>              }
>>          };
>> /*
>> Several LoadableDetachableModels, PageableListViews, Panels, Fragments
>>  etc.
>> */ } catch ( Exception ex){// create Custom Exception } finally {
>>   // Clean up of stuff }
>>
>>
>> My problem is that I am using AbstractColumn to display the objects in the
>> column and the overriden populateItem() method calls the load()
>> internally.  Since both the methods cannot throw Exceptions, I cannot
>> really catch exceptions and display appropriate messages.
>>
>> Any help on this is really appreciated.
>>
>>
>

Re: Wicket LoadableDetachableModel exception handling issue

Posted by Ondrej Zizka <oz...@redhat.com>.
How about wrapping it to a RuntimeException, or preferably, your own 
subclass of it?

Ondra



On 02/20/2013 04:51 PM, Jayakrishnan R wrote:
> In my project, I am using LoadableDetachableModel as given below.
>
> public ReportPage(final Objectm, final PageReference pr) throws
> CustomException{try{final LoadableDetachableModel<List<MaintReport>>
> ldm =
>           new LoadableDetachableModel<List<MaintReport>>() {
>
>              @Override
>              protected List<MaintReport>load() {
>                  **// Some Database operations //**
>                  return x;
>              }
>          };
> /*
> Several LoadableDetachableModels, PageableListViews, Panels, Fragments  etc.
> */ } catch ( Exception ex){// create Custom Exception } finally {
>   // Clean up of stuff }
>
>
> My problem is that I am using AbstractColumn to display the objects in the
> column and the overriden populateItem() method calls the load()
> internally.  Since both the methods cannot throw Exceptions, I cannot
> really catch exceptions and display appropriate messages.
>
> Any help on this is really appreciated.
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org