|
45 | 45 | import io.harness.exception.WingsException;
|
46 | 46 | import io.harness.exception.YamlException;
|
47 | 47 | import io.harness.exception.runtime.JGitRuntimeException;
|
| 48 | +import io.harness.exception.runtime.SCMRuntimeException; |
48 | 49 | import io.harness.filesystem.FileIo;
|
49 | 50 | import io.harness.git.model.AuthInfo;
|
50 | 51 | import io.harness.git.model.ChangeType;
|
|
91 | 92 | import java.util.stream.Stream;
|
92 | 93 | import lombok.extern.slf4j.Slf4j;
|
93 | 94 | import net.jodah.failsafe.Failsafe;
|
| 95 | +import net.jodah.failsafe.FailsafeException; |
94 | 96 | import net.jodah.failsafe.RetryPolicy;
|
95 | 97 | import org.apache.commons.io.FileUtils;
|
96 | 98 | import org.apache.commons.lang3.StringUtils;
|
@@ -346,6 +348,18 @@ public void validateOrThrow(GitBaseRequest request) {
|
346 | 348 | log.info(gitClientHelper.getGitLogMessagePrefix(request.getRepoType()) + "Git validation failed [{}]", e);
|
347 | 349 | if (e instanceof GitAPIException) {
|
348 | 350 | throw new JGitRuntimeException(e.getMessage(), e);
|
| 351 | + } else if (e instanceof FailsafeException) { |
| 352 | + if (e.getMessage().contains("upload-pack not found")) { |
| 353 | + throw SCMRuntimeException.builder() |
| 354 | + .message("Please provide correct git repo url") |
| 355 | + .errorCode(ErrorCode.GIT_CONNECTION_ERROR) |
| 356 | + .build(); |
| 357 | + } else { |
| 358 | + throw SCMRuntimeException.builder() |
| 359 | + .message("Git connection timed out") |
| 360 | + .errorCode(ErrorCode.CONNECTION_TIMEOUT) |
| 361 | + .build(); |
| 362 | + } |
349 | 363 | } else {
|
350 | 364 | throw new GeneralException(e.getMessage(), e);
|
351 | 365 | }
|
|
0 commit comments