Error reporting when snippet method not found

4 views
Skip to first unread message

Kjetil Valstadsve

unread,
Sep 29, 2009, 9:03:01 AM9/29/09
to Lift
Hi, I know I just raved about #liftweb error reporting on Twitter,
but... now that I found out what was wrong, I still have a gripe about
it. I am very unforgiving on error reporting logic, but most of the
time people's error handling is so hopeless that I just throw up my
arms and emit some mock Italian. When I bother to post this complaint,
it's because I think lift is doing great and I want to help improve
it.

The case occurs when a <lift:Foo.bar> tag fails to match the bar
method in Foo. The rendered red box (which is very nice) tells me that
the method was not found. However, it would be very handy if it
handled the special case of "method found but the signature is wrong".
As it is, I got the same message when I definitely had the method, per
se. Before I knew it, I was on a quest to find the outdated class
file, rebuilding here and there to make sure I had the war file in
synch with my code.

In my case, I hadn't specified the return type, and I was mistakenly
using foreach instead of flatMap inside the method, implicitly giving
Unit as return type. So lift was completely right, the method could
not be found. However, this is siding with the compiler against the
human, if you know what I mean. Also, since you cannot overload a
method by varying only the return type, it is a pretty safe assumption
that the mis-typed method is the one the user meant to use, especially
if it takes the correct argument list, too.

Kjetil

Derek Chen-Becker

unread,
Sep 30, 2009, 5:46:44 AM9/30/09
to lif...@googlegroups.com
Can you open a ticket on this? Lift uses reflection to locate the methods unless you're using a DispatchSnippet (the preferred way to do it), so we can probably enumerate all methods on the class and see if there is a method with the same name but different args or return types when we fail to locate something.

Derek

Kjetil Valstadsve

unread,
Sep 30, 2009, 3:33:13 PM9/30/09
to Lift
Sure.

Kjetil

On Sep 30, 11:46 am, Derek Chen-Becker <dchenbec...@gmail.com> wrote:
> Can you open a ticket on this? Lift uses reflection to locate the methods
> unless you're using a DispatchSnippet (the preferred way to do it), so we
> can probably enumerate all methods on the class and see if there is a method
> with the same name but different args or return types when we fail to locate
> something.
>
> Derek
>
Reply all
Reply to author
Forward
0 new messages