Source:
<code>public FormValidation doValidateRepositoryUrlAndCredentials(@CheckForNull @AncestorInPath Item context, @QueryParameter String repositoryUrl, @QueryParameter String credentialsId) { GitHubRepositoryInfo info; try { info = GitHubRepositoryInfo.forRepositoryUrl(repositoryUrl); <START> } catch (Throwable e) { <END> if (e instanceof IllegalArgumentException && e.getCause() != null) { e = e.getCause(); } return FormValidation.error(e, e.getMessage()); } if (context == null && !Jenkins.get().hasPermission(Jenkins.ADMINISTER) || context != null && !context.hasPermission(Item.EXTENDED_READ)) { return FormValidation.error("Unable to validate repository information"); } if (context != null && !context.hasPermission(CredentialsProvider.USE_ITEM)) { return FormValidation.error("Unable to validate repository information"); } FormValidation credentialsValidation = Connector.checkScanCredentials(context, info.getApiUri(), credentialsId); if (credentialsValidation.kind == FormValidation.Kind.ERROR) { return credentialsValidation; } StandardCredentials credentials = Connector.lookupScanCredentials(context, info.getApiUri(), credentialsId); StringBuilder sb = new StringBuilder(); GitHub github; try { github = Connector.connect(info.getApiUri(), credentials); if (github.isCredentialValid()){ sb.append("Credentials ok."); } } catch (IOException e) { return FormValidation.error(e, "Error connecting to API endpoint: " + info.getApiUri()); } try { GHRepository repo = github.getRepository(info.getRepoOwner() + "/" + info.getRepository()); if (repo != null) { sb.append(" Connected to "); sb.append(repo.getHtmlUrl()); sb.append("."); } } catch (IOException e) { return FormValidation.error(e, sb.toString() + " Error connecting to repository: " + e.getMessage()); } return FormValidation.ok(sb.toString()); }</code><technical_language>Catching a Throwable is a good idea. intention here</technical_language>

Target:
public FormValidation doValidateRepositoryUrlAndCredentials(@CheckForNull @AncestorInPath Item context, @QueryParameter String repositoryUrl, @QueryParameter String credentialsId) { if (context == null && !Jenkins.get().hasPermission(Jenkins.ADMINISTER) || context != null && !context.hasPermission(Item.EXTENDED_READ)) { return FormValidation.error("Unable to validate repository information"); } if (context != null && !context.hasPermission(CredentialsProvider.USE_ITEM)) { return FormValidation.error("Unable to validate repository information"); } GitHubRepositoryInfo info; try { info = GitHubRepositoryInfo.forRepositoryUrl(repositoryUrl); } catch (Exception e) { return FormValidation.error(e, e.getMessage()); } FormValidation credentialsValidation = Connector.checkScanCredentials(context, info.getApiUri(), credentialsId); if (credentialsValidation.kind == FormValidation.Kind.ERROR) { return credentialsValidation; } StandardCredentials credentials = Connector.lookupScanCredentials(context, info.getApiUri(), credentialsId); StringBuilder sb = new StringBuilder(); GitHub github; try { github = Connector.connect(info.getApiUri(), credentials); if (github.isCredentialValid()){ sb.append("Credentials ok."); } } catch (IOException e) { return FormValidation.error(e, "Error connecting to API endpoint: " + info.getApiUri()); } try { GHRepository repo = github.getRepository(info.getRepoOwner() + "/" + info.getRepository()); if (repo != null) { sb.append(" Connected to "); sb.append(repo.getHtmlUrl()); sb.append("."); } } catch (IOException e) { return FormValidation.error(e, sb.toString() + " Error connecting to repository: " + e.getMessage()); } return FormValidation.ok(sb.toString()); }