use of com.thoughtworks.go.server.util.ErrorHandler in project gocd by gocd.
the class ArtifactsController method handleError.
@ErrorHandler
public ModelAndView handleError(HttpServletRequest request, HttpServletResponse response, Exception e) {
LOGGER.error("Error loading artifacts: ", e);
Map model = new HashMap();
model.put(ERROR_FOR_PAGE, "Artifact does not exist.");
return new ModelAndView("exceptions_page", model);
}
use of com.thoughtworks.go.server.util.ErrorHandler 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);
}
Aggregations