Report error only where it is appropriate

This commit is contained in:
serso 2016-01-14 16:20:44 +01:00
parent 91a8a1122b
commit 6eb6b3cabe
3 changed files with 8 additions and 20 deletions

View File

@ -91,7 +91,6 @@ public class CalculatorDialogActivity extends ActionBarActivity {
final DialogData dialogData = readDialogData(getIntent());
if (dialogData == null) {
Locator.getInstance().getErrorReporter().onError("Dialog data is null!");
this.finish();
} else {
setContentView(R.layout.cpp_dialog);

View File

@ -22,6 +22,11 @@
package org.solovyev.android.calculator;
import java.text.DecimalFormatSymbols;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import jscl.AngleUnit;
import jscl.JsclMathEngine;
import jscl.MathEngine;
@ -32,10 +37,6 @@ import jscl.math.function.IConstant;
import jscl.math.operator.Operator;
import jscl.text.ParseException;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.text.DecimalFormatSymbols;
public class CalculatorEngineImpl implements CalculatorEngine {
/*
@ -180,28 +181,15 @@ public class CalculatorEngineImpl implements CalculatorEngine {
try {
registry.load();
} catch (Exception e) {
logException(e);
Locator.getInstance().getErrorReporter().onException(e);
}
}
private void logException(@Nonnull Exception e) {
final ErrorReporter errorReporter = Locator.getInstance().getErrorReporter();
errorReporter.onException(e);
}
@Override
public void softReset() {
Locator.getInstance().getCalculator().fireCalculatorEvent(CalculatorEventType.engine_preferences_changed, null);
}
/*
**********************************************************************
*
* PREFERENCES
*
**********************************************************************
*/
@Nonnull
@Override
public String getMultiplicationSign() {

View File

@ -23,6 +23,7 @@
package org.solovyev.android.calculator;
import android.text.TextUtils;
import android.util.Log;
import com.squareup.otto.Bus;
import com.squareup.otto.Subscribe;
@ -279,7 +280,7 @@ public class CalculatorImpl implements Calculator, CalculatorEventListener {
}
} catch (Throwable e) {
// todo serso: not good but we need proper synchronization
errorReporter.onException(e);
Log.e("Calculator", e.getMessage(), e);
}
}