yabe: add some error examples (403 and 404)

Bug #538784 reported by TGL
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
play framework
Status tracked in 1.0
1.0
Fix Released
Undecided
Unassigned
1.1
Fix Released
Undecided
Unassigned

Bug Description

http://groups.google.com/group/play-framework/browse_thread/thread/296e1de9e07bdfbf?hl=en

One thing I've found missing in the Yabe tutorial is examples of handling errors, like for instance in case of a bad post id (currently it gives a NPE). It took me some time before I've found out the notFound() method and such. Sure it was right under my nose, but for some reason I was not searching there, and thus my first solution for implementing a 404 response has been to explicitly throw a NotFound exception, because that's what I had found first in the API doc.

The attached patch is a small addition to the Yabe example:
 - add some notFoundIfNull() calls for handling bad post id
 - add some forbidden() calls for user X editing posts of user Y

I think seeing those would have helped me understand sooner that render() is not the only available result method.

Revision history for this message
TGL (tom-gl) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.