mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-03-23 04:07:11 +01:00
Logging changes and cleanup
This commit is contained in:
parent
b4a3473567
commit
35eea7aa3a
4 changed files with 17 additions and 28 deletions
|
@ -186,7 +186,7 @@ public class SkinUploader implements Closeable {
|
|||
try {
|
||||
gateway.performSkinUpload(new SkinUpload(mc.getSession(), skinType, localSkin == null ? null : localSkin.toURI(), skinMetadata));
|
||||
setError("");
|
||||
} catch (IOException | AuthenticationException e) {
|
||||
} catch (Exception e) {
|
||||
handleException(e);
|
||||
}
|
||||
}, HDSkinManager.skinUploadExecutor).thenRunAsync(this::fetchRemote);
|
||||
|
@ -229,13 +229,7 @@ public class SkinUploader implements Closeable {
|
|||
|
||||
fetchingSkin = false;
|
||||
|
||||
if (throwable instanceof AuthenticationUnavailableException) {
|
||||
offline = true;
|
||||
} else if (throwable instanceof InvalidCredentialsException) {
|
||||
setError("Invalid session: Please try restarting Minecraft");
|
||||
} else if (throwable instanceof AuthenticationException) {
|
||||
throttlingNeck = true;
|
||||
} else if (throwable instanceof HttpException) {
|
||||
if (throwable instanceof HttpException) {
|
||||
HttpException ex = (HttpException)throwable;
|
||||
|
||||
int code = ex.getStatusCode();
|
||||
|
@ -246,10 +240,22 @@ public class SkinUploader implements Closeable {
|
|||
} else if (code >= 400 && code != 403 && code != 404) {
|
||||
logger.error(ex.getReasonPhrase(), ex);
|
||||
setError(ex.getReasonPhrase());
|
||||
} else {
|
||||
logger.error(ex.getReasonPhrase(), ex);
|
||||
}
|
||||
} else {
|
||||
logger.error("Unhandled exception", throwable);
|
||||
setError(throwable.toString());
|
||||
logger.error("Unexpected error whilst contacting server at " + Objects.toString(gateway), throwable);
|
||||
|
||||
if (throwable instanceof AuthenticationUnavailableException) {
|
||||
offline = true;
|
||||
} else if (throwable instanceof InvalidCredentialsException) {
|
||||
setError("Invalid session: Please try restarting Minecraft");
|
||||
} else if (throwable instanceof AuthenticationException) {
|
||||
throttlingNeck = true;
|
||||
} else {
|
||||
logger.error("Unhandled exception", throwable);
|
||||
setError(throwable.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,10 +44,6 @@ public class BethlehemSkinServer implements SkinServer {
|
|||
@Override
|
||||
public TexturePayload loadProfileData(GameProfile profile) throws IOException {
|
||||
try (MoreHttpResponses response = new NetClient("GET", getPath(profile)).send()) {
|
||||
if (!response.ok()) {
|
||||
throw new HttpException(response.response());
|
||||
}
|
||||
|
||||
return response.requireOk().json(TexturePayload.class, "Invalid texture payload");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package com.voxelmodpack.hdskins.server;
|
||||
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.StatusLine;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class HttpException extends IOException {
|
||||
|
@ -12,14 +9,6 @@ public class HttpException extends IOException {
|
|||
|
||||
private final int statusCode;
|
||||
|
||||
public HttpException(HttpResponse response) {
|
||||
this(response.getStatusLine());
|
||||
}
|
||||
|
||||
public HttpException(StatusLine status) {
|
||||
this(status.getReasonPhrase(), status.getStatusCode(), null);
|
||||
}
|
||||
|
||||
public HttpException(String reason, int statusCode, Throwable cause) {
|
||||
super("(" + statusCode + ") " + reason, cause);
|
||||
|
||||
|
|
|
@ -88,9 +88,7 @@ public class LegacySkinServer implements SkinServer {
|
|||
|
||||
private MinecraftProfileTexture loadProfileTexture(GameProfile profile, String url) throws IOException {
|
||||
try (MoreHttpResponses resp = MoreHttpResponses.execute(HTTP_CLIENT, new HttpHead(url))) {
|
||||
if (!resp.ok()) {
|
||||
throw new HttpException(resp.response());
|
||||
}
|
||||
resp.requireOk();
|
||||
logger.debug("Found skin for {} at {}", profile.getName(), url);
|
||||
|
||||
Header eTagHeader = resp.response().getFirstHeader(HttpHeaders.ETAG);
|
||||
|
|
Loading…
Add table
Reference in a new issue