title: Is there a way to handle an exception thrown from inside of custom exception handler in Spring?
body: <p>Let's say a Spring Boot (2.1) has a <code>@RestControllerAdvice</code> which handles some custom exception.</p>
  
  <p>What if during an exception handler call, another exception is thrown. Is there a way to handle it rather than having Spring to send its own response body, which might look something like:</p>
  
  <pre><code>{
      "timestamp": "2020-01-31T03:03:55.228+0000",
      "status": 500,
      "error": "Internal Server Error",
      "message": "account: 2",
      "path": "/myendpoint/2"
  }
  
  @RestControllerAdvice
  public class MyExceptionHandler {
  
    @Autowired
    private MyOtherService otherService;
  
    @ExceptionHandler(SomeCustomException.class)
    public ResponseBody&lt;Object&gt; handleCustomException(SomeCustomException ex) {
      otherService.doSomething(); // This might throw, say, a RuntimeException
  
      return new ResponseBody&lt;&gt;(/* ... */);
    }
  }
  </code></pre>