I am developing the Jira plugin using Atlassian SDK
I want to create the controller advice to handle exception, but is is not working. How can I make the controller advice work? Here is my source code
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
@ControllerAdvice("com.jira.plugin.test")
public class ServiceErrorAdvice {
@ExceptionHandler({ServiceException.class})
public ResponseEntity<String> handleRunTimeException(ServiceException e) {
return error(INTERNAL_SERVER_ERROR, e);
}
private ResponseEntity<String> error(HttpStatus status, Exception e) {
return ResponseEntity.status(status).body(e.getMessage());
}
}
Hi @thien dinh ngoc ,
Welcome to the Atlassian Community!
Please notice that this is not the best place to get help on apps/add-on development related questions.
In case you won't manage any answer in here, you might want to refer to the resources listed in https://developer.atlassian.com/resources.
Specifically:
Cheers,
Dario
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.