add error code from SWTError & SWTExceotion to the report

This commit is contained in:
Anton Keks 2020-10-28 19:09:31 +02:00
parent fa29a56303
commit 273af65759

View File

@ -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());
}