Skip to content

Commit

Permalink
fix(retrofit): minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kirangodishala committed Nov 4, 2024
1 parent 7348b36 commit 02f132a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ class PipelineController {
Map getPipeline(@PathVariable("id") String id) {
try {
pipelineService.getPipeline(id)
} catch (SpinnakerServerException e) {
if (e instanceof SpinnakerHttpException && ((SpinnakerHttpException) e).responseCode == 404) {
} catch (SpinnakerHttpException e) {
if (e.responseCode == 404) {
throw new NotFoundException("Pipeline not found (id: ${id})")
}
}
Expand Down Expand Up @@ -339,8 +339,8 @@ class PipelineController {
@RequestParam("expression") String pipelineExpression) {
try {
pipelineService.evaluateExpressionForExecution(id, pipelineExpression)
} catch (SpinnakerServerException e) {
if (e instanceof SpinnakerHttpException && ((SpinnakerHttpException) e).responseCode == 404) {
} catch (SpinnakerHttpException e) {
if (e.responseCode == 404) {
throw new NotFoundException("Pipeline not found (id: ${id})")
}
}
Expand All @@ -352,8 +352,8 @@ class PipelineController {
@RequestBody String pipelineExpression) {
try {
pipelineService.evaluateExpressionForExecution(id, pipelineExpression)
} catch (SpinnakerServerException e) {
if (e instanceof SpinnakerHttpException && ((SpinnakerHttpException) e).responseCode == 404) {
} catch (SpinnakerHttpException e) {
if (e.responseCode == 404) {
throw new NotFoundException("Pipeline not found (id: ${id})")
}
}
Expand All @@ -366,8 +366,8 @@ class PipelineController {
@RequestParam("expression") String pipelineExpression) {
try {
pipelineService.evaluateExpressionForExecutionAtStage(id, stageId, pipelineExpression)
} catch (SpinnakerServerException e) {
if (e instanceof SpinnakerHttpException && ((SpinnakerHttpException) e).responseCode == 404) {
} catch (SpinnakerHttpException e) {
if (e.responseCode == 404) {
throw new NotFoundException("Pipeline not found (id: ${id})", e)
}
}
Expand All @@ -379,8 +379,8 @@ class PipelineController {
@RequestBody Map pipelineExpression) {
try {
pipelineService.evaluateExpressionForExecution(id, (String) pipelineExpression.expression)
} catch (SpinnakerServerException e) {
if (e instanceof SpinnakerHttpException && ((SpinnakerHttpException) e).responseCode == 404) {
} catch (SpinnakerHttpException e) {
if (e.responseCode == 404) {
throw new NotFoundException("Pipeline not found (id: ${id})")
}
}
Expand All @@ -402,8 +402,8 @@ class PipelineController {
@RequestBody List<Map<String, String>> expressions) {
try {
return pipelineService.evaluateVariables(executionId, requisiteStageRefIds, spelVersionOverride, expressions)
} catch (SpinnakerServerException e) {
if (e instanceof SpinnakerHttpException && ((SpinnakerHttpException) e).responseCode == 404) {
} catch (SpinnakerHttpException e) {
if (e.responseCode == 404) {
throw new NotFoundException("Pipeline not found (id: ${executionId})")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,9 @@ class ApplicationService {
log.error("front50 query for a pipeline with name ${pipelineNameOrId} in application ${app} returned a pipeline named ${pipelineConfig.name}")
// Tempting to return null here, but querying by id might work, so give it a shot.
} catch (SpinnakerHttpException e) {
if(e.getResponseCode() == HttpStatus.NOT_FOUND.value()){
if (e.getResponseCode() == HttpStatus.NOT_FOUND.value()) {
log.info("front50 returned no pipeline with name ${pipelineNameOrId} in application ${app}")
// fall through to try querying by id
} else {
throw e;
}
Expand Down

0 comments on commit 02f132a

Please sign in to comment.