Search in sources :

Example 1 with EmbeddedVariableCommentListIndexOutOfBoundsException

use of org.dbflute.twowaysql.exception.EmbeddedVariableCommentListIndexOutOfBoundsException in project dbflute-core by dbflute.

the class BoundValueTracer method throwListIndexOutOfBoundsException.

protected void throwListIndexOutOfBoundsException(String numberIndex, IndexOutOfBoundsException e) {
    final ExceptionMessageBuilder br = createExceptionMessageBuilder();
    br.addNotice("The list index on the " + _commentType.textName() + " was out of bounds.");
    br.addItem("Advice");
    br.addElement("Please confirm the index on your comment.");
    br.addItem(_commentType.titleName());
    br.addElement(_expression);
    br.addItem("OutOfBounds Index");
    br.addElement(numberIndex);
    br.addItem("IndexOutOfBoundsException");
    br.addElement(e.getMessage());
    br.addItem("Specified SQL");
    br.addElement(_specifiedSql);
    final String msg = br.buildExceptionMessage();
    if (ParameterCommentType.BIND.equals(_commentType)) {
        throw new BindVariableCommentListIndexOutOfBoundsException(msg, e);
    } else if (ParameterCommentType.EMBEDDED.equals(_commentType)) {
        throw new EmbeddedVariableCommentListIndexOutOfBoundsException(msg, e);
    } else if (ParameterCommentType.FORCOMMENT.equals(_commentType)) {
        throw new ForCommentListIndexOutOfBoundsException(msg, e);
    } else {
        // no way
        throw new BindVariableCommentListIndexOutOfBoundsException(msg, e);
    }
}
Also used : ForCommentListIndexOutOfBoundsException(org.dbflute.twowaysql.exception.ForCommentListIndexOutOfBoundsException) ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) BindVariableCommentListIndexOutOfBoundsException(org.dbflute.twowaysql.exception.BindVariableCommentListIndexOutOfBoundsException) EmbeddedVariableCommentListIndexOutOfBoundsException(org.dbflute.twowaysql.exception.EmbeddedVariableCommentListIndexOutOfBoundsException)

Aggregations

ExceptionMessageBuilder (org.dbflute.helper.message.ExceptionMessageBuilder)1 BindVariableCommentListIndexOutOfBoundsException (org.dbflute.twowaysql.exception.BindVariableCommentListIndexOutOfBoundsException)1 EmbeddedVariableCommentListIndexOutOfBoundsException (org.dbflute.twowaysql.exception.EmbeddedVariableCommentListIndexOutOfBoundsException)1 ForCommentListIndexOutOfBoundsException (org.dbflute.twowaysql.exception.ForCommentListIndexOutOfBoundsException)1