Search in sources :

Example 1 with RecordNotFoundException

use of com.thoughtworks.go.config.exceptions.RecordNotFoundException in project gocd by gocd.

the class BuildCauseControllerDelegate method index.

public String index(Request req, Response res) throws IOException {
    HttpOperationResult httpOperationResult = new HttpOperationResult();
    int result;
    try {
        result = Integer.parseInt(req.params(":pipeline_counter"));
    } catch (NumberFormatException nfe) {
        throw new RecordNotFoundException();
    }
    String pipelineName = req.params("pipeline_name");
    PipelineInstanceModel pipelineInstance = pipelineHistoryService.findPipelineInstance(pipelineName, result, currentUsername(), httpOperationResult);
    if (httpOperationResult.isSuccess()) {
        return writerForTopLevelObject(req, res, outputWriter -> BuildCauseRepresenter.toJSON(outputWriter, pipelineInstance.getBuildCause()));
    } else {
        return renderHTTPOperationResult(httpOperationResult, req, res);
    }
}
Also used : HttpOperationResult(com.thoughtworks.go.server.service.result.HttpOperationResult) RecordNotFoundException(com.thoughtworks.go.config.exceptions.RecordNotFoundException) PipelineInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel)

Aggregations

RecordNotFoundException (com.thoughtworks.go.config.exceptions.RecordNotFoundException)1 PipelineInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel)1 HttpOperationResult (com.thoughtworks.go.server.service.result.HttpOperationResult)1