Suggestion for better error message when action method is missing parameter

41 views
Skip to first unread message

gapps

unread,
Nov 14, 2010, 12:46:11 PM11/14/10
to play-framework
Hi,

Just a suggestion. I ran into the following problem:

My controller class defined an action method like so:


public static void editPOST() {

// method definition is missing the parameter
// really should be: public static void editPOST(Long id) {...}
}

In the view, I tried to insert a form:

#{form @Website.editPOST(page.id)}
...

This failed with a NullPointerException and no details:


Oops: NullPointerException
An unexpected error occured caused by exception NullPointerException:
null

play.exceptions.UnexpectedException: Unexpected Error
at play.mvc.results.RenderTemplate.apply(RenderTemplate.java:30)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:302)
at Invocation.HTTP Request(Play!)
Caused by: java.lang.NullPointerException
at play.mvc.results.RenderTemplate.apply(RenderTemplate.java:27)
... 2 more

Usually the Play! error messages are very detailed. Maybe this case
could be added and an appropriate error message (e.g. "Missing
parameter 'id'") can be added.

-Rico

Guillaume Bort

unread,
Nov 14, 2010, 12:48:31 PM11/14/10
to play-fr...@googlegroups.com
Yes of course, can you report this issue?

> --
> You received this message because you are subscribed to the Google Groups "play-framework" group.
> To post to this group, send email to play-fr...@googlegroups.com.
> To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.
>
>

--
Guillaume Bort, http://guillaume.bort.fr

For anything work-related, use g...@zenexity.fr; for everything else,
write guillau...@gmail.com

dirk

unread,
Nov 15, 2010, 11:40:52 AM11/15/10
to play-fr...@googlegroups.com
Please also include a request for a better error message when you forget to mark a Controller action method with static:

    public void test() {
    }

Action not found

Action Services.test could not be found. Error raised is MODULE$

Rico

unread,
Nov 15, 2010, 1:42:30 PM11/15/10
to play-framework
Reply all
Reply to author
Forward
0 new messages