UNPKG

@serenity-js/core

Version:

The core Serenity/JS framework, providing the Screenplay Pattern interfaces, as well as the test reporting and integration infrastructure

30 lines 1.07 kB
import { ensure, isDefined } from 'tiny-types'; import { ErrorSerialiser } from '../errors/index.js'; import { CorrelationId } from '../model/index.js'; import { Timestamp } from '../screenplay/index.js'; import { DomainEvent } from './DomainEvent.js'; /** * @group Events */ export class AsyncOperationFailed extends DomainEvent { error; correlationId; static fromJSON(o) { return new AsyncOperationFailed(ErrorSerialiser.deserialise(o.error), CorrelationId.fromJSON(o.correlationId), Timestamp.fromJSON(o.timestamp)); } constructor(error, correlationId, timestamp) { super(timestamp); this.error = error; this.correlationId = correlationId; ensure('error', error, isDefined()); ensure('correlationId', correlationId, isDefined()); } toJSON() { return { correlationId: this.correlationId.toJSON(), error: ErrorSerialiser.serialise(this.error), timestamp: this.timestamp.toJSON(), }; } } //# sourceMappingURL=AsyncOperationFailed.js.map