Fix: throw an error for unparsable color

This commit is contained in:
eight 2018-09-25 21:56:38 +08:00
parent 3c30bc3eb0
commit 9713c6a3be

View File

@ -12,7 +12,11 @@ var metaParser = (() => {
}, },
color: state => { color: state => {
if (state.value !== null) { 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');
} }
} }
} }