Exception Handler with different return type, same error

1k Views Asked by At

So, this is my first time asking in this forum and I hope i you guys can help me, sorry if my post has similar topics with others.

My question is, if i have this exception handler (Spring-mvc) :

@ExceptionHandler(value = MyException.class)
  @ResponseBody
  public Response responseExceptionHandler(MyException e,
      HttpServletRequest request) {
    LOG.error(e.getMessage(), e);
    return createResponse(e, request); //createresponse is a generic method i create somewhere in my class
  }

and as we can see it returns a Response, what if I have different return type, let's say ResponseList, but the same exception which is MyException will ExceptionHandler recognize the return type also ? or only recognize its error ?

Thanks, hope to hear good news and answers from you guys.

0

There are 0 best solutions below