UNPKG

1.12 kBTypeScriptView Raw
1import {SourceSpan} from './logger';
2
3/**
4 * An exception thrown because a Sass compilation failed.
5 *
6 * @category Other
7 */
8export class Exception extends Error {
9 private constructor();
10
11 /**
12 * A human-friendly representation of the exception.
13 *
14 * Because many tools simply print `Error.message` directly, this includes not
15 * only the textual description of what went wrong (the [[sassMessage]]) but
16 * also an indication of where in the Sass stylesheet the error occurred (the
17 * [[span]]) and the Sass stack trace at the point of error (the
18 * [[sassStack]]).
19 */
20 message: string;
21
22 /**
23 * A textual description of what went wrong.
24 *
25 * Unlike [[message]], this does *not* include representations of [[span]] or
26 * [[sassStack]].
27 */
28 readonly sassMessage: string;
29
30 /**
31 * A human-friendly representation of the Sass stack trace at the point of
32 * error.
33 */
34 readonly sassStack: string;
35
36 /** The location the error occurred in the Sass file that triggered it. */
37 readonly span: SourceSpan;
38
39 /** Returns the same string as [[message]]. */
40 toString(): string;
41}