2

How do I manually throw a 404 or 500 error in Play framework 1.2.x?

I am currently rendering the 404.html and 500.html templates using renderTemplate() method. But how do I do it the proper way ?

pnuts
  • 58,317
  • 11
  • 87
  • 139
Gautam
  • 7,868
  • 12
  • 64
  • 105

3 Answers3

6

Play Controller has error() and notFound() methods for this purpose.

axtavt
  • 239,438
  • 41
  • 511
  • 482
2

In your controller you can just invoke static error() method from Controller which will give 500 status.

PiotrkS
  • 381
  • 3
  • 6
0

return internalServerError(filledForm.errorsAsJson());

Mark
  • 2,522
  • 5
  • 36
  • 42