From e65b2df5a8775390e1aa9b75738b79ab9d135aee Mon Sep 17 00:00:00 2001 From: Adam Wathan Date: Mon, 13 Nov 2017 11:28:31 -0500 Subject: [PATCH] Improve error messages --- src/lib/substituteClassApplyAtRules.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/lib/substituteClassApplyAtRules.js b/src/lib/substituteClassApplyAtRules.js index 8ff2b97d1..ed5971d45 100644 --- a/src/lib/substituteClassApplyAtRules.js +++ b/src/lib/substituteClassApplyAtRules.js @@ -15,8 +15,7 @@ function findMixin(css, mixin, onError) { if (rule.selectors.includes(mixin)) { if (rule.parent.type !== 'root') { onError( - `\`@apply\` cannot be used with ${mixin} because ${mixin} is nested inside of an at-rule (@${rule - .parent.name}).` + `\`@apply\` cannot be used with ${mixin} because ${mixin} is nested inside of an at-rule (@${rule.parent.name}).` ) } @@ -25,7 +24,7 @@ function findMixin(css, mixin, onError) { }) if (_.isEmpty(matches) && _.isFunction(onError)) { - onError(`No ${mixin} class found.`) + onError(`\`@apply\` cannot be used with ${mixin} because ${mixin} either does not exist, or it's actual definition includes a pseudo-class like :hover, :active, etc.`) } return _.flatten(matches.map(match => match.clone().nodes))