@chix/flow
Version:
45 lines • 1.65 kB
JavaScript
;
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 (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var common_1 = require("../common");
var events_1 = require("../events");
var util_1 = require("../util");
function $Error(Base) {
return (function (_super) {
__extends(Error$, _super);
function Error$() {
return _super !== null && _super.apply(this, arguments) || this;
}
Error$.prototype.error = function (error) {
error = error instanceof Error ? error : Error(error);
this.setStatus('error');
var errorObject = {
msg: error,
node: this,
};
this.event(events_1.NodeEvents.ERROR, errorObject);
return error;
};
return Error$;
}(Base));
}
exports.$Error = $Error;
(function ($Error) {
function create(Base) {
return util_1.mixin(common_1.$Event.create, common_1.$Status.create)(Base);
}
$Error.create = create;
})($Error = exports.$Error || (exports.$Error = {}));
//# sourceMappingURL=error.js.map