Sass @error Rules

You are Here:

Sass @error Rules

When writing @function and @mixin that takes a dynamically generated value as an argument, you usually want to throw an error and stop further execution when the types or formats of the argument doesn't match your needs.

In the following example, @error will throw an error and stop further execution, when the parameter value is greater than 10.

Example

SASS TO CSS CONVERTER
@function myFunction($x){ @if $x > 10{ @error "$x value is too great"; } $result: $x * 2; @return $result; } footer ul{ font-size: myFunction(12) * 1px; }

Syntax

@error "error message";

Reminder

Hi Developers, we almost covered 99.1% of Sass Tutorials with examples for quick and easy learning.

We are working to cover every Single Concept in Sass.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author