summaryrefslogtreecommitdiff
path: root/node_modules/@11ty/eleventy/src/Errors/EleventyBaseError.js
blob: 6e76c5f8eee665013b314c0177c844f137b1e6e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/**
 * This class serves as basis for all Eleventy-specific errors.
 * @ignore
 */
class EleventyBaseError extends Error {
	/**
	 * @param {string} message - The error message to display.
	 * @param {unknown} [originalError] - The original error caught.
	 */
	constructor(message, originalError) {
		super(message);

		this.name = this.constructor.name;

		if (Error.captureStackTrace) {
			Error.captureStackTrace(this, this.constructor);
		}

		if (originalError) {
			this.originalError = originalError;
		}
	}
}
export default EleventyBaseError;