mirror of
https://github.com/danog/dart-sass.git
synced 2024-12-02 09:37:49 +01:00
Include names in unit assertion errors.
This commit is contained in:
parent
28c7362016
commit
7564b6a51a
@ -278,7 +278,7 @@ class SassNumber extends Value {
|
|||||||
/// (without the `$`). It's used for debugging.
|
/// (without the `$`). It's used for debugging.
|
||||||
void assertUnit(String unit, [String name]) {
|
void assertUnit(String unit, [String name]) {
|
||||||
if (hasUnit(unit)) return;
|
if (hasUnit(unit)) return;
|
||||||
throw _exception('Expected $this to have unit "$unit".');
|
throw _exception('Expected $this to have unit "$unit".', name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Throws a [SassScriptException] unless [this] has no units.
|
/// Throws a [SassScriptException] unless [this] has no units.
|
||||||
@ -287,7 +287,7 @@ class SassNumber extends Value {
|
|||||||
/// (without the `$`). It's used for debugging.
|
/// (without the `$`). It's used for debugging.
|
||||||
void assertNoUnits([String name]) {
|
void assertNoUnits([String name]) {
|
||||||
if (!hasUnits) return;
|
if (!hasUnits) return;
|
||||||
throw _exception('Expected $this to have no units.');
|
throw _exception('Expected $this to have no units.', name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a copy of this number, converted to the units represented by
|
/// Returns a copy of this number, converted to the units represented by
|
||||||
|
Loading…
Reference in New Issue
Block a user