@serenity-js/core
Version:
The core Serenity/JS framework, providing the Screenplay Pattern interfaces, as well as the test reporting and integration infrastructure
34 lines • 1.36 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AsyncOperationFailed = void 0;
const tiny_types_1 = require("tiny-types");
const index_js_1 = require("../errors/index.js");
const index_js_2 = require("../model/index.js");
const index_js_3 = require("../screenplay/index.js");
const DomainEvent_js_1 = require("./DomainEvent.js");
/**
* @group Events
*/
class AsyncOperationFailed extends DomainEvent_js_1.DomainEvent {
error;
correlationId;
static fromJSON(o) {
return new AsyncOperationFailed(index_js_1.ErrorSerialiser.deserialise(o.error), index_js_2.CorrelationId.fromJSON(o.correlationId), index_js_3.Timestamp.fromJSON(o.timestamp));
}
constructor(error, correlationId, timestamp) {
super(timestamp);
this.error = error;
this.correlationId = correlationId;
(0, tiny_types_1.ensure)('error', error, (0, tiny_types_1.isDefined)());
(0, tiny_types_1.ensure)('correlationId', correlationId, (0, tiny_types_1.isDefined)());
}
toJSON() {
return {
correlationId: this.correlationId.toJSON(),
error: index_js_1.ErrorSerialiser.serialise(this.error),
timestamp: this.timestamp.toJSON(),
};
}
}
exports.AsyncOperationFailed = AsyncOperationFailed;
//# sourceMappingURL=AsyncOperationFailed.js.map