diff --git a/igor-web/src/main/groovy/com/netflix/spinnaker/igor/scm/stash/CommitController.groovy b/igor-web/src/main/groovy/com/netflix/spinnaker/igor/scm/stash/CommitController.groovy index cc79b1565..99772431d 100644 --- a/igor-web/src/main/groovy/com/netflix/spinnaker/igor/scm/stash/CommitController.groovy +++ b/igor-web/src/main/groovy/com/netflix/spinnaker/igor/scm/stash/CommitController.groovy @@ -46,16 +46,21 @@ class CommitController extends AbstractCommitController { CompareCommitsResponse commitsResponse try { commitsResponse = stashMaster.stashClient.getCompareCommits(projectKey, repositorySlug, requestParams) - } catch (SpinnakerServerException e) { - if (e instanceof SpinnakerNetworkException) { - throw new NotFoundException("Could not find the server ${stashMaster.baseUrl}") - } else if (e instanceof SpinnakerHttpException && ((SpinnakerHttpException)e).getResponseCode() == 404) { + } catch (SpinnakerNetworkException e) { + throw new NotFoundException("Could not find the server ${stashMaster.baseUrl}") + } catch (SpinnakerHttpException e) { + if(e.getResponseCode() == 404) { return getNotFoundCommitsResponse(projectKey, repositorySlug, requestParams.to, requestParams.from, stashMaster.baseUrl) - } - log.error( + } + log.error( "Failed to fetch commits for {}/{}, reason: {}", projectKey, repositorySlug, e.message ) + }catch (SpinnakerServerException e) { + log.error( + "Failed to fetch commits for {}/{}, reason: {}", + projectKey, repositorySlug, e.message + ) } List result = [] diff --git a/igor-web/src/main/groovy/com/netflix/spinnaker/igor/scm/stash/client/StashMaster.groovy b/igor-web/src/main/groovy/com/netflix/spinnaker/igor/scm/stash/client/StashMaster.groovy index 123f704f4..883236757 100644 --- a/igor-web/src/main/groovy/com/netflix/spinnaker/igor/scm/stash/client/StashMaster.groovy +++ b/igor-web/src/main/groovy/com/netflix/spinnaker/igor/scm/stash/client/StashMaster.groovy @@ -35,10 +35,10 @@ class StashMaster extends AbstractScmMaster { List listDirectory(String projectKey, String repositorySlug, String path, String ref) { try { return stashClient.listDirectory(projectKey, repositorySlug, path, ref).toChildFilenames() - } catch (SpinnakerServerException e) { - if (e instanceof SpinnakerNetworkException) { - throw new NotFoundException("Could not find the server ${baseUrl}") - } + }catch (SpinnakerNetworkException e) { + throw new NotFoundException("Could not find the server ${baseUrl}") + } + catch (SpinnakerServerException e) { log.error( "Failed to fetch file from {}/{}/{}, reason: {}", projectKey, repositorySlug, path, e.message @@ -61,10 +61,9 @@ class StashMaster extends AbstractScmMaster { contents += response.toTextContents() + "\n" } return contents - } catch (SpinnakerServerException e) { - if (e instanceof SpinnakerNetworkException) { - throw new NotFoundException("Could not find the server ${baseUrl}") - } + } catch (SpinnakerNetworkException e) { + throw new NotFoundException("Could not find the server ${baseUrl}") + } catch(SpinnakerServerException e) { log.error( "Failed to fetch file from {}/{}/{}, reason: {}", projectKey, repositorySlug, path, e.message diff --git a/igor-web/src/main/groovy/com/netflix/spinnaker/igor/wercker/WerckerBuildMonitor.groovy b/igor-web/src/main/groovy/com/netflix/spinnaker/igor/wercker/WerckerBuildMonitor.groovy index 879935592..9b74a8fe9 100644 --- a/igor-web/src/main/groovy/com/netflix/spinnaker/igor/wercker/WerckerBuildMonitor.groovy +++ b/igor-web/src/main/groovy/com/netflix/spinnaker/igor/wercker/WerckerBuildMonitor.groovy @@ -183,7 +183,7 @@ class WerckerBuildMonitor extends CommonPollingMonitor