mirror of
https://github.com/danog/dart-sass.git
synced 2024-11-27 04:34:59 +01:00
Merge pull request #781 from sass/error-reporting
Clean up a few error messages
This commit is contained in:
commit
51b446193b
@ -1,3 +1,12 @@
|
||||
## 1.22.9
|
||||
|
||||
* Include argument names when reporting range errors and selector parse errors.
|
||||
|
||||
* Avoid double `Error:` headers when reporting selector parse errors.
|
||||
|
||||
* Clarify the error message when the wrong number of positional arguments are
|
||||
passed along with a named argument.
|
||||
|
||||
## 1.22.8
|
||||
|
||||
### JavaScript API
|
||||
|
@ -81,6 +81,7 @@ class ArgumentDeclaration implements SassNode {
|
||||
|
||||
if (positional > arguments.length) {
|
||||
throw SassScriptException("Only ${arguments.length} "
|
||||
"${names.isEmpty ? '' : 'positional '}"
|
||||
"${pluralize('argument', arguments.length)} allowed, but "
|
||||
"${positional} ${pluralize('was', positional, plural: 'were')} "
|
||||
"passed.");
|
||||
|
@ -120,7 +120,7 @@ abstract class Value implements ext.Value {
|
||||
} on SassFormatException catch (error) {
|
||||
// TODO(nweiz): colorize this if we're running in an environment where
|
||||
// that works.
|
||||
throw _exception(error.toString());
|
||||
throw _exception(error.toString().replaceFirst("Error: ", ""), name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -140,7 +140,7 @@ abstract class Value implements ext.Value {
|
||||
} on SassFormatException catch (error) {
|
||||
// TODO(nweiz): colorize this if we're running in an environment where
|
||||
// that works.
|
||||
throw _exception(error.toString());
|
||||
throw _exception(error.toString().replaceFirst("Error: ", ""), name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -161,7 +161,7 @@ abstract class Value implements ext.Value {
|
||||
} on SassFormatException catch (error) {
|
||||
// TODO(nweiz): colorize this if we're running in an environment where
|
||||
// that works.
|
||||
throw _exception(error.toString());
|
||||
throw _exception(error.toString().replaceFirst("Error: ", ""), name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -209,7 +209,8 @@ class SassNumber extends Value implements ext.SassNumber {
|
||||
var result = fuzzyCheckRange(value, min, max);
|
||||
if (result != null) return result;
|
||||
throw _exception(
|
||||
"Expected $this to be within $min$unitString and $max$unitString.");
|
||||
"Expected $this to be within $min$unitString and $max$unitString.",
|
||||
name);
|
||||
}
|
||||
|
||||
bool hasUnit(String unit) =>
|
||||
|
@ -562,7 +562,7 @@ class _SerializeVisitor
|
||||
_buffer.writeCharCode($lbracket);
|
||||
} else if (value.asList.isEmpty) {
|
||||
if (!_inspect) {
|
||||
throw SassScriptException("() isn't a valid CSS value");
|
||||
throw SassScriptException("() isn't a valid CSS value.");
|
||||
}
|
||||
_buffer.write("()");
|
||||
return;
|
||||
|
@ -1,5 +1,5 @@
|
||||
name: sass
|
||||
version: 1.22.8
|
||||
version: 1.22.9-dev
|
||||
description: A Sass implementation in Dart.
|
||||
author: Dart Team <misc@dartlang.org>
|
||||
homepage: https://github.com/sass/dart-sass
|
||||
|
Loading…
Reference in New Issue
Block a user