UNPKG

934 BJavaScriptView Raw
1
2/*!
3 * Stylus - errors
4 * Copyright (c) Automattic <developer.wordpress.com>
5 * MIT Licensed
6 */
7
8/**
9 * Expose constructors.
10 */
11
12exports.ParseError = ParseError;
13exports.SyntaxError = SyntaxError;
14
15/**
16 * Initialize a new `ParseError` with the given `msg`.
17 *
18 * @param {String} msg
19 * @api private
20 */
21
22function ParseError(msg) {
23 this.name = 'ParseError';
24 this.message = msg;
25 if (Error.captureStackTrace) {
26 Error.captureStackTrace(this, ParseError);
27 }
28}
29
30/**
31 * Inherit from `Error.prototype`.
32 */
33
34ParseError.prototype.__proto__ = Error.prototype;
35
36/**
37 * Initialize a new `SyntaxError` with the given `msg`.
38 *
39 * @param {String} msg
40 * @api private
41 */
42
43function SyntaxError(msg) {
44 this.name = 'SyntaxError';
45 this.message = msg;
46 if (Error.captureStackTrace) {
47 Error.captureStackTrace(this, ParseError);
48 }
49}
50
51/**
52 * Inherit from `Error.prototype`.
53 */
54
55SyntaxError.prototype.__proto__ = Error.prototype;