From 9713c6a3beedc1da8d0d111214e295e745d19956 Mon Sep 17 00:00:00 2001 From: eight Date: Tue, 25 Sep 2018 21:56:38 +0800 Subject: [PATCH] Fix: throw an error for unparsable color --- js/meta-parser.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/js/meta-parser.js b/js/meta-parser.js index 8eaf9c61..08e53181 100644 --- a/js/meta-parser.js +++ b/js/meta-parser.js @@ -12,7 +12,11 @@ var metaParser = (() => { }, color: state => { if (state.value !== null) { - colorConverter.format(colorConverter.parse(state.value), 'rgb'); + const color = colorConverter.parse(state.value); + if (!color) { + throw new Error(`invalid color: ${state.value}`); + } + state.value = colorConverter.format(color, 'rgb'); } } }