mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2024-11-24 11:36:51 +01:00
Just report HTTP errors, no need to make tickets out of them.
This commit is contained in:
parent
429ca5d447
commit
1880add7dc
@ -17,6 +17,8 @@
|
|||||||
|
|
||||||
package com.comphenix.protocol;
|
package com.comphenix.protocol;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
@ -74,9 +76,13 @@ class CommandProtocol extends CommandBase {
|
|||||||
UpdateResult result = updater.update(UpdateType.NO_DOWNLOAD, true);
|
UpdateResult result = updater.update(UpdateType.NO_DOWNLOAD, true);
|
||||||
sender.sendMessage(ChatColor.BLUE + "[ProtocolLib] " + result.toString());
|
sender.sendMessage(ChatColor.BLUE + "[ProtocolLib] " + result.toString());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
if (isHttpError(e)) {
|
||||||
|
getReporter().reportWarning(this, "Http error: " + e.getCause().getMessage());
|
||||||
|
} else {
|
||||||
getReporter().reportDetailed(this, "Cannot check updates for ProtocolLib.", e, sender);
|
getReporter().reportDetailed(this, "Cannot check updates for ProtocolLib.", e, sender);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}, 0L);
|
}, 0L);
|
||||||
|
|
||||||
updateFinished();
|
updateFinished();
|
||||||
@ -91,14 +97,29 @@ class CommandProtocol extends CommandBase {
|
|||||||
UpdateResult result = updater.update(UpdateType.DEFAULT, true);
|
UpdateResult result = updater.update(UpdateType.DEFAULT, true);
|
||||||
sender.sendMessage(ChatColor.BLUE + "[ProtocolLib] " + result.toString());
|
sender.sendMessage(ChatColor.BLUE + "[ProtocolLib] " + result.toString());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
if (isHttpError(e)) {
|
||||||
|
getReporter().reportWarning(this, "Http error: " + e.getCause().getMessage());
|
||||||
|
} else {
|
||||||
getReporter().reportDetailed(this, "Cannot update ProtocolLib.", e, sender);
|
getReporter().reportDetailed(this, "Cannot update ProtocolLib.", e, sender);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}, 0L);
|
}, 0L);
|
||||||
|
|
||||||
updateFinished();
|
updateFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isHttpError(Exception e) {
|
||||||
|
Throwable cause = e.getCause();
|
||||||
|
|
||||||
|
if (cause instanceof IOException) {
|
||||||
|
// Thanks for making the message a part of the API ...
|
||||||
|
return cause.getMessage().contains("HTTP response");
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prevent further automatic updates until the next delay.
|
* Prevent further automatic updates until the next delay.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user