From 273af657596d5590386d654e317439dfe820e082 Mon Sep 17 00:00:00 2001 From: Anton Keks Date: Wed, 28 Oct 2020 19:09:31 +0200 Subject: [PATCH] add error code from SWTError & SWTExceotion to the report --- src/net/azib/ipscan/util/GoogleAnalytics.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/net/azib/ipscan/util/GoogleAnalytics.java b/src/net/azib/ipscan/util/GoogleAnalytics.java index b30dbda9..1ff1d6ed 100644 --- a/src/net/azib/ipscan/util/GoogleAnalytics.java +++ b/src/net/azib/ipscan/util/GoogleAnalytics.java @@ -2,6 +2,8 @@ package net.azib.ipscan.util; import net.azib.ipscan.config.Config; import net.azib.ipscan.config.Version; +import org.eclipse.swt.SWTError; +import org.eclipse.swt.SWTException; import java.io.OutputStream; import java.net.HttpURLConnection; @@ -64,7 +66,8 @@ public class GoogleAnalytics { element = stackTraceElement; if (element.getClassName().startsWith("net.azib.ipscan")) break; } - return e.toString() + (element == null ? "" : "\n" + + int code = e instanceof SWTError ? ((SWTError) e).code : e instanceof SWTException ? ((SWTException) e).code : -1; + return e.toString() + (code >= 0 ? " (" + code + ")" : "") + (element == null ? "" : "\n" + element.getClassName() + "." + element.getMethodName() + ":" + element.getLineNumber()); }