It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to use @ControllerAdvice for Jira Plugin Development?

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());
  }
}

 

1 answer

0 votes
Dario Atlassian Team Nov 06, 2019

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

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira

Demo Den Ep. 7: New Jira Cloud Reports

Learn how to use two new reports for next-gen projects in Jira Cloud:  Cumulative flow diagram and Sprint burndown chart. Ivan Teong, Product Manager, Jira Software, demos the Cumulative ...

275 views 1 2
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you