Skip to content

Commit 1694ab9

Browse files
committed
throw exception if token missing
1 parent 0d3d346 commit 1694ab9

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/main/java/com/chuntung/plugin/gistsnippet/service/GistException.java

+4
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,8 @@ public class GistException extends RuntimeException {
88
GistException(Exception e) {
99
super(e);
1010
}
11+
12+
public GistException(String message) {
13+
super(message);
14+
}
1115
}

src/main/java/com/chuntung/plugin/gistsnippet/service/GithubAccountHolder.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
package com.chuntung.plugin.gistsnippet.service;
66

7-
87
import com.intellij.credentialStore.CredentialAttributes;
98
import com.intellij.ide.passwordSafe.PasswordSafe;
109
import com.intellij.openapi.components.ServiceManager;
@@ -37,7 +36,7 @@ public String getAccessToken() {
3736
// org.jetbrains.plugins.github.authentication.accounts.GithubAccountManager.getTokenForAccount
3837
String token = PasswordSafe.getInstance().getPassword(new CredentialAttributes("IntelliJ Platform GitHub — " + accountId));
3938
if (token == null) {
40-
logger.warn("Only support token to access Github API, please add account by token");
39+
throw new GistException("Only token is supported to access GitHub API, please add account through token");
4140
}
4241
return token;
4342
}

0 commit comments

Comments
 (0)