Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

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

A Bundler with the web in mind.
Go to Latest
method postcss.Node.prototype.error
Re-export
import { postcss } from "https://deno.land/x/bundler@0.6.5/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.