From 3a3df71e3fdb3fec2d081e31eec226087118294c Mon Sep 17 00:00:00 2001 From: Cole Bemis Date: Sat, 4 Nov 2017 21:09:13 -0700 Subject: [PATCH] refactor(replace): Replace `console.error` with `throw new Error` --- src/replace.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/replace.js b/src/replace.js index e322b10..d07b860 100644 --- a/src/replace.js +++ b/src/replace.js @@ -32,13 +32,11 @@ function replaceElement(element, options) { const key = element.getAttribute('data-feather'); if (!key) { - console.error('The required `data-feather` attribute has no value.'); - return; + throw new Error('The required `data-feather` attribute has no value.'); } if (!icons[key]) { - console.error(`No icon matching '${key}'. See the complete list of icons at https://feathericons.com`); - return; + throw new Error(`No icon matching '${key}'. See the complete list of icons at https://feathericons.com`); } const elementClassAttr = element.getAttribute('class') || '';