Skip to content

Commit

Permalink
Merge pull request #14 from RappyLabyAddons/fix/networkExceptions
Browse files Browse the repository at this point in the history
Show error achievement on ApiRequest#handleException
  • Loading branch information
RappyTV authored Nov 25, 2023
2 parents 6226a37 + e744685 commit 2b7d936
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/src/main/java/com/rappytv/globaltags/api/ApiRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.google.gson.Gson;
import com.rappytv.globaltags.GlobalTagAddon;
import com.rappytv.globaltags.config.GlobalTagConfig;
import com.rappytv.globaltags.util.Util;
import net.labymod.api.util.I18n;
import java.net.URI;
import java.net.http.HttpClient;
Expand Down Expand Up @@ -66,9 +67,10 @@ public CompletableFuture<Void> sendAsyncRequest() {

private Void handleException(Throwable e, CompletableFuture<Void> future) {
e.printStackTrace();
future.complete(null);
error = GlobalTagConfig.exceptions ? e.getMessage() : I18n.translate("globaltags.notifications.unknownError");
future.completeExceptionally(e);
successful = false;
error = GlobalTagConfig.exceptions ? e.getMessage() : I18n.translate("globaltags.notifications.unknownError");
Util.notify(I18n.translate("globaltags.notifications.error"), error, !isSuccessful());
return null;
}

Expand Down

0 comments on commit 2b7d936

Please sign in to comment.