Skip to content

Commit 4480a9a

Browse files
minor changes
1 parent e78afa3 commit 4480a9a

File tree

3 files changed

+162
-132
lines changed

3 files changed

+162
-132
lines changed

lib/checks/mobile/target-offset-evaluate.js

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,27 @@ export default function targetOffsetEvaluate(node, options, vNode) {
2020
continue;
2121
}
2222
// the offset code works off radius but we want our messaging to reflect diameter
23-
const offset =
24-
roundToSingleDecimal(getOffset(vNode, vNeighbor, minOffset / 2)) * 2;
23+
let offset = null;
24+
try {
25+
offset = getOffset(vNode, vNeighbor, minOffset / 2);
26+
} catch (err) {
27+
if (err.message.startsWith('splitRects')) {
28+
this.data({
29+
messageKey: 'tooManyRects',
30+
closestOffset: 0,
31+
minOffset
32+
});
33+
return undefined;
34+
}
35+
36+
throw err;
37+
}
38+
39+
if (offset === null) {
40+
continue;
41+
}
42+
43+
offset = roundToSingleDecimal(offset) * 2;
2544
if (offset + roundingMargin >= minOffset) {
2645
continue;
2746
}

0 commit comments

Comments
 (0)