yabe: add some error examples (403 and 404)
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://
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.