throw an exception when a specified position is valid in slice()