do not report "normal" user errors to Google Analytics, only unexpected crashes

This commit is contained in:
Anton Keks 2020-10-28 18:54:05 +02:00
parent a7634b50c1
commit fa29a56303
4 changed files with 11 additions and 28 deletions

View File

@ -5,15 +5,14 @@
*/
package net.azib.ipscan.exporters;
import net.azib.ipscan.core.UserErrorException;
/**
* Exception for throwing in case of problems in Exporters.
*
* @author Anton Keks
*/
public class ExporterException extends IllegalArgumentException {
static final long serialVersionUID = 746237846273847L;
public class ExporterException extends UserErrorException {
public ExporterException(String message) {
super(message);
}

View File

@ -5,22 +5,15 @@
*/
package net.azib.ipscan.feeders;
import net.azib.ipscan.core.UserErrorException;
/**
* Exception for throwing in case of problems with Feeders.
*
* @author Anton Keks
*/
public class FeederException extends IllegalArgumentException {
static final long serialVersionUID = 746237846273847L;
public class FeederException extends UserErrorException {
public FeederException(String message) {
super(message);
}
public FeederException(String message, Throwable cause) {
super(message);
initCause(cause);
}
}

View File

@ -5,19 +5,9 @@
*/
package net.azib.ipscan.fetchers;
/**
* FetcherException
*
* @author Anton Keks
*/
public class FetcherException extends RuntimeException {
private static final long serialVersionUID = 1L;
public FetcherException(Throwable cause) {
super(cause);
}
import net.azib.ipscan.core.UserErrorException;
public class FetcherException extends UserErrorException {
public FetcherException(String label, Throwable cause) {
super(label, cause);
}
@ -25,5 +15,4 @@ public class FetcherException extends RuntimeException {
public FetcherException(String label) {
super(label);
}
}

View File

@ -58,6 +58,9 @@ public class GUI implements AutoCloseable {
String localizedMessage = getLocalizedMessage(e);
showMessage(e instanceof UserErrorException ? SWT.ICON_WARNING : SWT.ICON_ERROR,
getLabel(e instanceof UserErrorException ? "text.userError" : "text.error"), localizedMessage);
if (!(e instanceof UserErrorException) || e.getCause() != null)
new GoogleAnalytics().report(e);
}
}
}
@ -70,7 +73,6 @@ public class GUI implements AutoCloseable {
messageBox.setText(title);
messageBox.setMessage(localizedMessage);
messageBox.open();
new GoogleAnalytics().report(localizedMessage, (Throwable) null);
}
@Override public void close() {