playframework/Play20 — pull request #345 by julienrf (2012-06-02 13:30:17+00:00)
Title: Handle runtime errors of async results

Fixes [#496](https://play.lighthouseapp.com/projects/82401/tickets/496-201-scala-globalonerror-isnt-called-when-an-exception-occurs-in-an-akkafuture): runtime errors occuring in an async result are hooked to the `Global.onError` handler.

Notes:
* I think it should be fixed in a better way: async results and sync results should be unified (sync results could be lifted to an async result, for example) at some point earlier so we would **not** have to handle the errors at two different places in the code (`PlayDefaultUpstreamHandler` for async results and `Invoker` for sync results) ;
* I was unable to write tests running in a fake application (runtime exceptions of sync results are not caught by the fake application, and runtime exception of async results gave me the following error: “RuntimeException: Cannot extract the body content from a result of type play.api.mvc.AsyncResult”).