java - Throwing exceptions in Controller methods Play framework? -


i using play framework (2.5) java development. in that, configure routes , routes relative controller methods triggered.

i have question whether ok include exception throws in these controller method signatures or must catch them inside method body?

ex:

public result getpurchasedstatisticsoutofallpricechecked(string from, string to) throws invalidparameterexception, salesserviceexception {          requestparams requestparams = new requestparams(messageprovider);         requestparams.setdaterangestart(from);         requestparams.setdaterangeend(to);          return ok(processinfluenceonsales(influenceonoverallsales)); } 

i think better way handle exceptions inside action method, instead of throwing. can respond client relevant error message, otherwise end

500 internal server error

and stacktrace looks following play.api.http.httperrorhandlerexceptions$$anon$1: execution exception followed respective exception trace.


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

android - CoordinatorLayout, FAB and container layout conflict -