Search in sources :

Example 1 with FetchingOverSafetySizeException

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);
}
Also used : FetchingOverSafetySizeException(org.dbflute.exception.FetchingOverSafetySizeException) DangerousResultSizeException(org.dbflute.exception.DangerousResultSizeException) ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) ConditionBean(org.dbflute.cbean.ConditionBean)

Aggregations

ConditionBean (org.dbflute.cbean.ConditionBean)1 DangerousResultSizeException (org.dbflute.exception.DangerousResultSizeException)1 FetchingOverSafetySizeException (org.dbflute.exception.FetchingOverSafetySizeException)1 ExceptionMessageBuilder (org.dbflute.helper.message.ExceptionMessageBuilder)1