if(userForm.hasErrors()) {
return badRequest(form.render(userForm));
} else {
User user = userForm.get();
return ok("Got user " + user);
}
We just have a generic method that accepts a form, and if a form is not good we throw an BadRequest exception which inherits from UsefulException.
We then return 400 with a message.
The problem is that the framework logs the excpetion in log before it gives us the control. So the exception is logged and then method onError is called. We don't know what to do about it. The logs just get poluted by exceptions that we throw.
Is this a bug or a feature?
Why would you log an exception before giving it to the code that is supposed to handle it. It makes no sense to me.
Is there any way to prevent this behavior?
Kind regards
M.
--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framewor...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framewor...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
catch { case NonFatal(e) => try { Logger.error( """ | |! %sInternal server error, for (%s) [%s] -> |""".stripMargin.format(e match { case p: PlayException => "@" + p.id + " - " case _ => "" }, request.method, request.uri), e ) global.onError(request, e) } catch { case NonFatal(e) => DefaultGlobal.onError(request, e) }
Logger.error is called first and then global.onError
So the log that is being generated starts with
"Internal server error, for" if somebody can tell me how to make this logger shut up i will be more than greatful.
Regards,
M.
catch {
case NonFatal(e) => try {
Logger.error(
"""
|
|! %sInternal server error, for (%s) [%s] ->
|""".stripMargin.format(e match {
case p: PlayException => "@" + p.id + " - "
case _ => ""
}, request.method, request.uri),
e
)
global.onError(request, e)
} catch {case NonFatal(e) => DefaultGlobal.onError(request, e)
}
catch {
case NonFatal(e) => try {
global.onError(request, e)
} catch {
Logger.error( "Unhandled Internal Server Error" ... )
case NonFatal(e) => DefaultGlobal.onError(request, e)
}
--
You received this message because you are subscribed to a topic in the Google Groups "play-framework" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/play-framework/YSASFRpATTQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to play-framewor...@googlegroups.com.
That's great James, thanks a lot!I'm not sure I understand your branch strategy/release process. When/in which version will this be released?
In 2.4.0? And will that be released somewhere in the beginning of 2015?