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
Post a Comment