dolphhinsr_dart icon indicating copy to clipboard operation
dolphhinsr_dart copied to clipboard

There should be an explicit exception thrown when combinations refers to non existent fields

Open banool opened this issue 3 years ago • 0 comments

Imagine a card like this:

Master(
    id: sw.getKey(word),
    fields: ["x", "y"],
    combinations: [
        Combination(front: [0], back: [1]),
        Combination(front: [1], back: [2]),
    ],
);

This is invalid because there are only two fields but we erroneously refer to index 2 in the second combination.

This results in a tricky to debug error inside the library:

RangeError (RangeError (index): Invalid value: Not in inclusive range 0..1: 2)

Instead we should have an explicit exception.

I can make a PR for this some time later.

banool avatar Feb 24 '22 11:02 banool