Skip to content

Error message is not explicit when default Sorter does not exist #41

@Ludovic-BAILET

Description

@Ludovic-BAILET

Define a default OrderCriteria with a filed who is not defined as Sorter throw an error:

java com.avisto.jpasearch.exception.FieldNotInCriteriaException: Field lastname is not specified in criteria

example :

public enum ExampleCriteria implements ISearchCriteriaConfig<Example> {

    LASTNAME(FilterConfig.of("lastname", StringFilterOperation.CONTAIN_IGNORE_CASE, "lastname"));

    final ISearchConfig<RegionalDirector> searchConfig;

    @Override
    public OrderCriteria getDefaultOrderCriteria() {
        return new OrderCriteria(LASTNAME.getKey(), SortDirection.DESC);
    }
    
    @Override
    public Class<Example> getRootClass() {
        return Example.class;
    }
}

The error message is not explicit because the field exists but he has not defined as a sorter.

Proposition for a more explicit message :

Field lastname is not a Sorter

Metadata

Metadata

Labels

bugSomething isn't working

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions