Throw an error early if the direction is not ascending, descending or null