89 lines
3.1 KiB
JavaScript
89 lines
3.1 KiB
JavaScript
"use strict";
|
|
var __extends = (this && this.__extends) || (function () {
|
|
var extendStatics = function (d, b) {
|
|
extendStatics = Object.setPrototypeOf ||
|
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
return extendStatics(d, b);
|
|
};
|
|
return function (d, b) {
|
|
if (typeof b !== "function" && b !== null)
|
|
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
extendStatics(d, b);
|
|
function __() { this.constructor = d; }
|
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
};
|
|
})();
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.Exception = void 0;
|
|
//================================================================
|
|
/**
|
|
* @packageDocumentation
|
|
* @module std
|
|
*/
|
|
//================================================================
|
|
/**
|
|
* Base Exception.
|
|
*
|
|
* @author Jeongho Nam - https://github.com/samchon
|
|
*/
|
|
var Exception = /** @class */ (function (_super) {
|
|
__extends(Exception, _super);
|
|
/* ---------------------------------------------------------
|
|
CONSTRUCTOR
|
|
--------------------------------------------------------- */
|
|
/**
|
|
* Initializer Constructor.
|
|
*
|
|
* @param message The error messgae.
|
|
*/
|
|
function Exception(message) {
|
|
var _newTarget = this.constructor;
|
|
var _this = _super.call(this, message) || this;
|
|
// INHERITANCE POLYFILL
|
|
var proto = _newTarget.prototype;
|
|
if (Object.setPrototypeOf)
|
|
Object.setPrototypeOf(_this, proto);
|
|
else
|
|
_this.__proto__ = proto;
|
|
return _this;
|
|
}
|
|
Object.defineProperty(Exception.prototype, "name", {
|
|
/* ---------------------------------------------------------
|
|
ACCESSORS
|
|
--------------------------------------------------------- */
|
|
/**
|
|
* The error name.
|
|
*/
|
|
get: function () {
|
|
return this.constructor.name;
|
|
},
|
|
enumerable: false,
|
|
configurable: true
|
|
});
|
|
/**
|
|
* Get error message.
|
|
*
|
|
* @return The error message.
|
|
*/
|
|
Exception.prototype.what = function () {
|
|
return this.message;
|
|
};
|
|
/**
|
|
* Native function for `JSON.stringify()`.
|
|
*
|
|
* The {@link Exception.toJSON} function returns only three properties; ({@link name}, {@link message} and {@link stack}). If you want to define a new sub-class extending the {@link Exception} and const the class to export additional props (or remove some props), override this {@link Exception.toJSON} method.
|
|
*
|
|
* @return An object for `JSON.stringify()`.
|
|
*/
|
|
Exception.prototype.toJSON = function () {
|
|
return {
|
|
name: this.name,
|
|
message: this.message,
|
|
stack: this.stack,
|
|
};
|
|
};
|
|
return Exception;
|
|
}(Error));
|
|
exports.Exception = Exception;
|
|
//# sourceMappingURL=Exception.js.map
|