[2.0.1-scala] promise.orTimeout hides exceptions
While implementing an async action similar to the http://www.playframework.org/documentation/2.0/ScalaAsync example, I noticed that exceptions thrown inside intensiveComputation() are logged correctly with an "error" log level only if the promise is not composed with promise.orTimeout. If using orTimeout, the exception is logged only on a debug level and without a stack trace, and the response is returned only after the timeout occurs. This is not very good when running in production mode, since errors would be silently swallowed.
Here's a sample log entry when using orTimeout:
[DEBUG] [05/15/2012 10:28:40.767] [application-akka.actor.default-dispatcher-1] [Future] TypeDoesNotMatch(Cannot convert xxxxx:class java.lang.String to Long for column users.id)
And here is a sample when not using orTimeout:
[DEBUG] [05/15/2012 10:31:14.369] [application-akka.actor.default-dispatcher-2] [Future] TypeDoesNotMatch(Cannot convert xxxxxx:class java.lang.String to Long for column users.id) [error] play - Waiting for a promise, but got an error: TypeDoesNotMatch(Cannot convert xxxxxx:class java.lang.String to Long for column users.id)
Would it be possible to get the exception logged on an error level also when using orTimeout? I can work around the issue by explicitly catching and logging exceptions inside the intensiveComputation() method, but it doesn't seem to be a clean solution.
Comments and changes to this ticket
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »