Github: properly log exceptions (not only notification message)

This commit is contained in:
Aleksey Pivovarov
2013-07-26 16:43:53 +04:00
parent 1ddf23f650
commit 51ae176045
5 changed files with 12 additions and 10 deletions
@@ -114,6 +114,11 @@ public class GithubNotifications {
LOG.warn(title + "; " + message);
}
public static void showErrorDialog(final @Nullable Project project, final @NotNull String title, final @NotNull Exception e) {
Messages.showErrorDialog(project, e.getMessage(), title);
LOG.warn(title, e);
}
public static int showYesNoDialog(final @Nullable Project project, final @NotNull String title, final @NotNull String message) {
return Messages.showYesNoDialog(project, message, title, Messages.getQuestionIcon());
}
@@ -207,7 +207,7 @@ public class GithubRebaseAction extends DumbAwareAction {
return null;
}
catch (IOException e) {
GithubNotifications.showError(project, CANNOT_PERFORM_GITHUB_REBASE, "Can't load repository info: " + e.getMessage());
GithubNotifications.showError(project, "Can't load repository info", e);
return null;
}
}
@@ -224,7 +224,7 @@ public class GithubShareAction extends DumbAwareAction {
if (exceptionRef.get() instanceof GithubAuthenticationCanceledException) {
return null;
}
GithubNotifications.showErrorDialog(project, "Failed to connect to GitHub", exceptionRef.get().getMessage());
GithubNotifications.showErrorDialog(project, "Failed to connect to GitHub", exceptionRef.get());
return null;
}
return githubInfoRef.get();
@@ -278,7 +278,7 @@ public class GithubShareAction extends DumbAwareAction {
}
}
catch (VcsException e) {
GithubNotifications.showError(project, "Failed to add GitHub repository as remote", e.getMessage());
GithubNotifications.showError(project, "Failed to add GitHub repository as remote", e);
return false;
}
return true;
@@ -346,6 +346,7 @@ public class GithubShareAction extends DumbAwareAction {
VcsFileUtil.refreshFiles(project, modified);
}
catch (VcsException e) {
LOG.warn(e);
GithubNotifications.showErrorURL(project, "Can't finish GitHub sharing process", "Successfully created project ", "'" + name + "'",
" on GitHub, but initial commit failed:<br/>" + e.getMessage(), url);
return false;
@@ -286,7 +286,7 @@ public class GithubUtil {
version = GitVersion.identifyVersion(executable);
}
catch (Exception e) {
GithubNotifications.showErrorDialog(project, GitBundle.getString("find.git.error.title"), e.getMessage());
GithubNotifications.showErrorDialog(project, GitBundle.getString("find.git.error.title"), e);
return false;
}
@@ -108,14 +108,10 @@ public class GitHubRepositoryEditor extends BaseRepositoryEditor<GitHubRepositor
}
});
if (!exceptionRef.isNull()) {
GithubNotifications.showErrorDialog(myProject, "Error", "Can't check token scopes");
GithubNotifications.showErrorDialog(myProject, "Can't check token scopes", exceptionRef.get());
return;
}
Collection<String> scopes = scopesRef.get();
if (scopes == null) {
GithubNotifications.showErrorDialog(myProject, "Error", "Can't check token scopes");
return;
}
if (myPrivateRepo.isSelected()) {
scopes.remove("repo");
}
@@ -152,7 +148,7 @@ public class GitHubRepositoryEditor extends BaseRepositoryEditor<GitHubRepositor
if (exceptionRef.get() instanceof GithubAuthenticationCanceledException) {
return;
}
GithubNotifications.showErrorDialog(myProject, "Can't get access token", exceptionRef.get().getMessage());
GithubNotifications.showErrorDialog(myProject, "Can't get access token", exceptionRef.get());
return;
}
myToken.setText(tokenRef.get());