title: Http status code for Exceptions
body: <p>i have a SpringBoot controller, and i want to return the correct http code status for Exceptions. So, my question is: Which http statu code is better for Exception the "500" one or "409" one?</p>
  
  <p>This is my code:</p>
  
  <pre><code>@PostMapping(value = {"", "/"})
  public ResponseEntity&lt;Response&gt; create(@RequestBody StudioDto studioDto,
          ServletRequest servletRequest, ServletResponse servletResponse) {
  
      Response response = new Response();
  
      try {
          studioService.createStudio(studioDto);
          response.setMessage("The studio was create");
          response.setStatusCode(HttpServletResponse.SC_CREATED);
  
      } catch (Exception e) {
          response.setMessage("Op we have a little problem");
          response.setErrorMessage(e.getMessage());
  
          //Which one
          //this one 5xx
          response.setStatusCode(500);
          //Or this one 4xx
          response.setStatusCode(409);
      }
  
      return new ResponseEntity(response, response.getHttpStatus());
  }
  </code></pre>