From 11a721d0b816b946e1946118e3380d0ecb99768d Mon Sep 17 00:00:00 2001 From: Isaac Parks Date: Tue, 22 Nov 2022 14:12:39 -0600 Subject: [PATCH 1/4] chore: throws a simple message if there is an error finding icon defs --- js-packages/@fortawesome/fontawesome-svg-core/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/js-packages/@fortawesome/fontawesome-svg-core/index.js b/js-packages/@fortawesome/fontawesome-svg-core/index.js index a5bc717a82..50559833e3 100644 --- a/js-packages/@fortawesome/fontawesome-svg-core/index.js +++ b/js-packages/@fortawesome/fontawesome-svg-core/index.js @@ -1134,8 +1134,13 @@ for (var _len = arguments.length, definitions = new Array(_len), _key = 0; _key < _len; _key++) { definitions[_key] = arguments[_key]; } + try { + var additions = definitions.reduce(this._pullDefinitions, {}); + } + catch (ex){ + throw 'Could not find provided icon. ' + ex.message + } - var additions = definitions.reduce(this._pullDefinitions, {}); Object.keys(additions).forEach(function (key) { _this.definitions[key] = _objectSpread2(_objectSpread2({}, _this.definitions[key] || {}), additions[key]); defineIcons(key, additions[key]); // TODO can we stop doing this? We can't get the icons by 'fa-solid' any longer so this probably needs to change From 7933635717040f7494d2db3898781b867407474a Mon Sep 17 00:00:00 2001 From: Isaac Parks Date: Tue, 22 Nov 2022 14:17:55 -0600 Subject: [PATCH 2/4] chore: updates error message --- js-packages/@fortawesome/fontawesome-svg-core/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js-packages/@fortawesome/fontawesome-svg-core/index.js b/js-packages/@fortawesome/fontawesome-svg-core/index.js index 50559833e3..7b6e517d9b 100644 --- a/js-packages/@fortawesome/fontawesome-svg-core/index.js +++ b/js-packages/@fortawesome/fontawesome-svg-core/index.js @@ -1138,7 +1138,7 @@ var additions = definitions.reduce(this._pullDefinitions, {}); } catch (ex){ - throw 'Could not find provided icon. ' + ex.message + throw 'Could not find provided icon(s). ' + ex.message } Object.keys(additions).forEach(function (key) { From af884cdd6d3187c8410ae26d809602e13b0b88de Mon Sep 17 00:00:00 2001 From: Isaac Parks Date: Tue, 22 Nov 2022 14:25:23 -0600 Subject: [PATCH 3/4] defines additions --- js-packages/@fortawesome/fontawesome-svg-core/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js-packages/@fortawesome/fontawesome-svg-core/index.js b/js-packages/@fortawesome/fontawesome-svg-core/index.js index 7b6e517d9b..412d28976e 100644 --- a/js-packages/@fortawesome/fontawesome-svg-core/index.js +++ b/js-packages/@fortawesome/fontawesome-svg-core/index.js @@ -1134,8 +1134,9 @@ for (var _len = arguments.length, definitions = new Array(_len), _key = 0; _key < _len; _key++) { definitions[_key] = arguments[_key]; } + var additions = [] try { - var additions = definitions.reduce(this._pullDefinitions, {}); + additions = definitions.reduce(this._pullDefinitions, {}); } catch (ex){ throw 'Could not find provided icon(s). ' + ex.message From e971c6069bb27300f7076a487b9dbac080c4586a Mon Sep 17 00:00:00 2001 From: Isaac Parks Date: Tue, 22 Nov 2022 14:27:11 -0600 Subject: [PATCH 4/4] changes additions to init as an object --- js-packages/@fortawesome/fontawesome-svg-core/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js-packages/@fortawesome/fontawesome-svg-core/index.js b/js-packages/@fortawesome/fontawesome-svg-core/index.js index 412d28976e..d555de6572 100644 --- a/js-packages/@fortawesome/fontawesome-svg-core/index.js +++ b/js-packages/@fortawesome/fontawesome-svg-core/index.js @@ -1134,7 +1134,7 @@ for (var _len = arguments.length, definitions = new Array(_len), _key = 0; _key < _len; _key++) { definitions[_key] = arguments[_key]; } - var additions = [] + var additions = {} try { additions = definitions.reduce(this._pullDefinitions, {}); }