Playback uses Exceptions to control flow β instead of having your methods return something like a Model, they all throw Exceptions. They are not marked with exceptions (e.g. NullPointerException, etc.), which means that you do not need a throws in your method signature.
Many people are scared of the fact that Play throws exceptions similar to this, but actually very fast. There are two reasons for this.
- Java exception throwing is much faster than it was.
- If you look at the parent class of
RenderJson , you will see that the method called fillInStackTrace() (at least I think it called) was overridden to do nothing - creating this detailed stack trace you get when that something goes wrong, takes a lot of time, but this is usually normal, because exceptions are usually not thrown all the time. With Play, which uses them to control the flow, it was necessary to remove part of the trace generation of the code stack.
source share