private void addErrorToHistory(Object o) {
TestResultError error = null;
if (o instanceof Throwable) {
error = new TestResultException((Throwable) o);
} else if (o != null) {
error = new TestResultStringError(o.toString());
} else {
error = new TestResultStringError("An unknown error occurred.");
}
history.add(LoadSourceResult.error(tx, error));
}