UNPKG

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