From fbfadb0887bd7e2f51b1790e2cbdddc1a83efc72 Mon Sep 17 00:00:00 2001 From: Ghost_chu <2908803755@qq.com> Date: Sat, 11 Jan 2020 15:26:41 +0800 Subject: [PATCH] Pre gen paste Former-commit-id: ae1da2d00d21a2c04ae0edaa6b66b7e9034bccfc --- .../org/maxgamer/quickshop/Util/SentryErrorReporter.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/org/maxgamer/quickshop/Util/SentryErrorReporter.java b/src/main/java/org/maxgamer/quickshop/Util/SentryErrorReporter.java index badd6e809..354cb52d0 100644 --- a/src/main/java/org/maxgamer/quickshop/Util/SentryErrorReporter.java +++ b/src/main/java/org/maxgamer/quickshop/Util/SentryErrorReporter.java @@ -57,6 +57,7 @@ public class SentryErrorReporter { /* Pre-init it if it called before the we create it... */ private SentryClient sentryClient; private boolean tempDisable; + private String lastPaste; public SentryErrorReporter(@NotNull QuickShop plugin) { this.plugin = plugin; @@ -97,7 +98,10 @@ public class SentryErrorReporter { if (!plugin.getConfig().getBoolean("auto-report-errors")) { Util.debugLog("Sentry error report was disabled, unloading..."); unit(); + return; } + Paste paste = new Paste(plugin); + this.lastPaste = paste.paste(paste.genNewPaste()); } /** @@ -225,8 +229,12 @@ public class SentryErrorReporter { try { Paste paste = new Paste(plugin); pasteURL = paste.paste(paste.genNewPaste()); + if(pasteURL != null && !pasteURL.isEmpty()){ + lastPaste = pasteURL; + } } catch (Throwable ex) { //Ignore + pasteURL = this.lastPaste; } this.context.addTag("paste", pasteURL); this.sentryClient.sendException(throwable);