mirror of
https://github.com/hyperdefined/ToolStats.git
synced 2025-12-06 06:41:44 +00:00
Merge pull request #96 from sebampuero/fix-unhandled-githubrelease-exception
Fix: catch unhandled exception when version does not exist yet
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
<groupId>lol.hyper</groupId>
|
<groupId>lol.hyper</groupId>
|
||||||
<artifactId>toolstats</artifactId>
|
<artifactId>toolstats</artifactId>
|
||||||
<version>1.9.2-hotfix-2</version>
|
<version>1.9.3</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>ToolStats</name>
|
<name>ToolStats</name>
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package lol.hyper.toolstats;
|
|||||||
|
|
||||||
import lol.hyper.githubreleaseapi.GitHubRelease;
|
import lol.hyper.githubreleaseapi.GitHubRelease;
|
||||||
import lol.hyper.githubreleaseapi.GitHubReleaseAPI;
|
import lol.hyper.githubreleaseapi.GitHubReleaseAPI;
|
||||||
|
import lol.hyper.githubreleaseapi.ReleaseNotFoundException;
|
||||||
import lol.hyper.toolstats.commands.CommandToolStats;
|
import lol.hyper.toolstats.commands.CommandToolStats;
|
||||||
import lol.hyper.toolstats.events.*;
|
import lol.hyper.toolstats.events.*;
|
||||||
import lol.hyper.toolstats.tools.*;
|
import lol.hyper.toolstats.tools.*;
|
||||||
@@ -251,12 +252,14 @@ public final class ToolStats extends JavaPlugin {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
GitHubRelease current = api.getReleaseByTag(this.getPluginMeta().getVersion());
|
GitHubRelease current;
|
||||||
GitHubRelease latest = api.getLatestVersion();
|
try{
|
||||||
if (current == null) {
|
current = api.getReleaseByTag(this.getPluginMeta().getVersion());
|
||||||
|
}catch(ReleaseNotFoundException e){
|
||||||
logger.warning("You are running a version that does not exist on GitHub. If you are in a dev environment, you can ignore this. Otherwise, this is a bug!");
|
logger.warning("You are running a version that does not exist on GitHub. If you are in a dev environment, you can ignore this. Otherwise, this is a bug!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
GitHubRelease latest = api.getLatestVersion();
|
||||||
int buildsBehind = api.getBuildsBehind(current);
|
int buildsBehind = api.getBuildsBehind(current);
|
||||||
if (buildsBehind == 0) {
|
if (buildsBehind == 0) {
|
||||||
logger.info("You are running the latest version.");
|
logger.info("You are running the latest version.");
|
||||||
|
|||||||
Reference in New Issue
Block a user