Code

< 40 %
40-60 %
> 60 %
1
// Error.js
2
"use strict";
3
4
// :: DEPENDENCIES
5
6
// load native dependencies
7 1
const path = require("path");
8
9
// load local dependencies
10 1
const Throwable = require(path.join(__dirname, "Throwable.js"));
11
12
// :: BASIC SETUP
13
14
/**
15
 * The class <tt>Error</tt> and its subclasses are a form of <tt>Throwable</tt> that indicates conditions that a
16
 * reasonable application might want to catch.
17
 * @param {String} name - The name of the <tt>Error</tt>.
18
 * @param {String} message - The message describing the <tt>Error</tt>.
19
 * @param {Number} code - The unique code that identifies the cause of the <tt>Error</tt>.
20
 * @augments Throwable
21
 * @constructor
22
 * @see https://docs.oracle.com/javase/8/docs/api/java/lang/Error.html
23
 */
24 1
const Error2 = function (name, message, code) {
25 2060
    Throwable.call(this, name, message, code);
26
};
27
28
// :: INHERITANCE
29
30
// set the prototype chain parent to the Throwable 'class'
31 1
Error2.prototype = Object.create(Throwable.prototype);
32
33
// set the prototype chain constructor
34 1
Error2.prototype.constructor = Error2;
35
36
// :: PROTOTYPE
37
38
/**
39
 * The name used to identify an <tt>Error</tt>.
40
 * @type {String}
41
 * @default
42
 */
43 1
Error2.prototype.name = "Error";
44
45
// :: EXPORT
46
47
// export the Error 'class'
48
module.exports = Error2;