use of org.dbflute.exception.FetchingOverSafetySizeException in project dbflute-core by dbflute.
the class BehaviorExceptionThrower method throwDangerousResultSizeException.
public void throwDangerousResultSizeException(FetchBean fetchBean, Throwable cause) {
final int safetyMaxResultSize = fetchBean.getSafetyMaxResultSize();
final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
br.addNotice("You've already been in DANGER ZONE. (check is working)");
br.addItem("Advice");
br.addElement("The selected size is over the specified safety size.");
br.addElement("Confirm your conditions and table records.");
br.addItem("Safety Max Result Size");
br.addElement(safetyMaxResultSize);
if (fetchBean instanceof ConditionBean) {
final ConditionBean cb = ((ConditionBean) fetchBean);
setupInvalidQueryElement(br, cb);
setupFetchSizeElement(br, cb);
setupDisplaySqlElement(br, cb);
} else {
br.addItem("Fetch Bean");
br.addElement(fetchBean);
if (cause instanceof FetchingOverSafetySizeException) {
final String sql = ((FetchingOverSafetySizeException) cause).getDangerousDisplaySql();
if (sql != null) {
br.addItem("Dangerous SQL");
br.addElement(sql);
}
}
}
final String msg = br.buildExceptionMessage();
throw new DangerousResultSizeException(msg, cause, safetyMaxResultSize);
}
Aggregations