playframework/playframework — pull request #2437 by andrewconner (2014-03-04 04:22:09+00:00)
Title: Adding onError to PlayRunHook, which is called whenever play run has an exception.

Adding onError to PlayRunHook, which is called on all `PlayRunHook`s whenever play run has an exception, so that resources can be cleaned up.

(Diff best viewed with ?w=1)

* `PlayRun` now calls the hook’s `onError` on any failure between the calling of `beforeStarted` to the end of the run task.
* Previously, Play swallowed all but the last exception when calling `run`. Now, when multiple exceptions are thrown, they’re combined into a `RunHookCompositeThrowable` (modeled directly after `scala.collection.parallel.CompositeThrowable`), which will make the logs more clear.
* Added test coverage to `PlayRunHook`.

It’s useful to let `PlayRunHook`s be notified when there was an exception during Play’s life cycle. For example, if we had resources open or were a running process (like a Grunt watch task) in a `PlayRunHook`, it needs to be cleaned up.

The TypeSafe CLA should be signed.