From 56120436ef2ee0471f9d854333d64579f759f48f Mon Sep 17 00:00:00 2001 From: Mingye Wang Date: Fri, 9 Apr 2021 23:28:48 +0800 Subject: [PATCH] bezier: properly complain when number of colors is bad Maybe I should've generalized the 5 case into a bisecting or windowed implementation, but I am too lazy to actually test that. Fixes #245. --- src/generator/bezier.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/generator/bezier.js b/src/generator/bezier.js index 177e91ea..f0f9c04f 100644 --- a/src/generator/bezier.js +++ b/src/generator/bezier.js @@ -42,6 +42,8 @@ const bezier = function(colors) { return I1((t-0.5)*2); } }; + } else { + throw new RangeError("Bezier can only accept between 2 to 5 colors; got `${colors.length}`.") } return I; };