import { __extends } from "tslib";
import { hasOwnProperty } from './hasOwn';
var ExtendableError = (function (_super) {
    __extends(ExtendableError, _super);
    function ExtendableError(message) {
        if (message === void 0) { message = ''; }
        var _this = _super.call(this, message) || this;
        Object.defineProperty(_this, 'message', {
            configurable: true,
            enumerable: false,
            value: message,
            writable: true,
        });
        Object.defineProperty(_this, 'name', {
            configurable: true,
            enumerable: false,
            value: _this.constructor.name,
            writable: true,
        });
        if (hasOwnProperty(Error, 'captureStackTrace')) {
            Error.captureStackTrace(_this, _this.constructor);
            return _this;
        }
        Object.defineProperty(_this, 'stack', {
            configurable: true,
            enumerable: false,
            value: new Error(message).stack,
            writable: true,
        });
        return _this;
    }
    return ExtendableError;
}(Error));
export default ExtendableError;
