java - Postman returns status 500 regardless of which JEE exeption do I use -


i'm developing spring boot app simple @restcontroller.

here's code snippet bugs me.

  else if (validators.iscommentvalid(submission) == false)   throw new webapplicationexception("comment field empty", 400);   //throw new badrequestexception("comment field cannot empty");   //throw new httpexception(400); 

the idea behind it: when comment field empty, return 400 status (bad request).

i've tried multiple jee (based on avax.ws.rs) exceptions, , work fine when comes relaying message etc, status returned postman 500.

not sure missing, ideas?

you can try define own exception , annotate them

@responsestatus(value=httpstatus.not_found, reason="comment field empty") 

see more here


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -