Skip to content

Commit

Permalink
Github connection message (#24)
Browse files Browse the repository at this point in the history
* Output help message when can’t connect to Github

* Bumped compiler version.
  • Loading branch information
bobgarner committed Jan 21, 2024
1 parent 8d589fe commit 7df3e7f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/main/java/org/entityc/compiler/EntityCompiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

public class EntityCompiler {

public static final String COMPILER_VERSION = "0.18.1";
public static final String COMPILER_VERSION = "0.18.2";
public static final String LANGUAGE_VERSION = "0.15.0";
private static final Map<String, String> defineValues = new HashMap<>();
private static final Set<String> templateSearchPath = new HashSet<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,23 @@ public GitHubRepositoryImporter() {
super();
}

private void showGithubConnectionError( MTRepository repository )
{
ECLog.logError(
"Unable to connect to GitHub: " + repository.getOrganization() + "/" + repository.getRepoName());
ECLog.log("This program uses the following Github API library: https://github-api.kohsuke.org\n" +
"One of the easiest ways to configure Github access is to set the GITHUB_OAUTH environment variable to your\n" +
"Github Personal Access Token. See the above URL for other ways to configure Github access.");
System.exit(1);
}
@Override
public RepositoryFile importFromRepository(MTRepository repository, MTRepositoryImport repositoryImport, RepositoryFile cachedRepositoryFile, String extension, String alternatePath) {
try {
if (github == null) {
github = GitHub.connect();
}
} catch (IOException e) {
ECLog.logFatal(
"Unable to connect to GitHub: " + repository.getOrganization() + "/" + repository.getRepoName()
+ "\n" + e.getMessage());
showGithubConnectionError(repository);
}
String pathPart = alternatePath != null ?
(alternatePath + "/") :
Expand Down Expand Up @@ -105,9 +112,7 @@ public void updateRepositoryCommitSHA1(MTRepository repository) {
github = GitHub.connect();
}
} catch (IOException e) {
ECLog.logFatal(
"Unable to connect to GitHub: " + repository.getOrganization() + "/" + repository.getRepoName()
+ "\n" + e.getMessage());
showGithubConnectionError(repository);
}

GHRepository repo = null;
Expand Down

0 comments on commit 7df3e7f

Please sign in to comment.