Skip to content

Commit

Permalink
Print the LHS first in incompatible unit errors
Browse files Browse the repository at this point in the history
Closes #766
  • Loading branch information
nex3 committed Dec 29, 2020
1 parent d532f01 commit f9a9373
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/src/value/number.dart
Expand Up @@ -496,7 +496,15 @@ class SassNumber extends Value implements ext.SassNumber {
num num2;
if (hasUnits) {
num1 = value;
num2 = other.coerceValueToMatch(this);
try {
num2 = other.coerceValueToMatch(this);
} on SassScriptException {
// If the conversion fails, re-run it in the other direction. This will
// generate an error message that prints [this] before [other], which is
// more readable.
this.coerceValueToMatch(other);
rethrow; // This should be unreachable.
}
} else {
num1 = coerceValueToMatch(other);
num2 = other.value;
Expand Down

0 comments on commit f9a9373

Please sign in to comment.