Search in sources :

Example 1 with StageNotFoundException

use of com.thoughtworks.go.config.StageNotFoundException in project gocd by gocd.

the class StageController method handleError.

@ErrorHandler
public ModelAndView handleError(HttpServletRequest request, HttpServletResponse response, Exception e) {
    Map<String, Object> json = new LinkedHashMap<>();
    String message = e.getMessage();
    if (e instanceof StageNotFoundException) {
        StageNotFoundException stageNotFoundException = (StageNotFoundException) e;
        message = format("Stage '%s' of pipeline '%s' does not exist in current configuration. You can not rerun it.", stageNotFoundException.getStageName(), stageNotFoundException.getPipelineName());
    }
    addFriendlyErrorMessage(json, message);
    return jsonNotAcceptable(json).respond(response);
}
Also used : StageNotFoundException(com.thoughtworks.go.config.StageNotFoundException) LinkedHashMap(java.util.LinkedHashMap) ErrorHandler(com.thoughtworks.go.server.util.ErrorHandler)

Aggregations

StageNotFoundException (com.thoughtworks.go.config.StageNotFoundException)1 ErrorHandler (com.thoughtworks.go.server.util.ErrorHandler)1 LinkedHashMap (java.util.LinkedHashMap)1