Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/fed_dev/deps.ts>postcss.Node#error

A Bundler with the web in mind.
Latest
method postcss.Node.prototype.error
Re-export
import { postcss } from "https://deno.land/x/fed_dev@0.9.0/deps.ts";
const { Node } = postcss;

Returns a CssSyntaxError instance containing the original position of the node in the source, showing line and column numbers and also a small excerpt to facilitate debugging.

If present, an input source map will be used to get the original position of the source, even from a previous compilation step (e.g., from Sass compilation).

This method produces very useful error messages.

if (!variables[name]) {
  throw decl.error(`Unknown variable ${name}`, { word: name })
  // CssSyntaxError: postcss-vars:a.sass:4:3: Unknown variable $black
  //   color: $black
  // a
  //          ^
  //   background: white
}

Parameters

message: string

Error description.

optional
options: NodeErrorOptions

Options.

Returns

Error object to throw it.