suspenders-js
Version:
Asynchronous programming library utilizing coroutines, functional reactive programming and structured concurrency.
59 lines • 2.12 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ScopeFinishingError = exports.HasCompletedError = exports.ObserverError = exports.FlowRemoveObserverError = exports.FlowConsumedError = void 0;
/**
* Thrown when attempting to consume a Flow that has already been consumed.
*/
class FlowConsumedError extends Error {
constructor() {
super(...arguments);
this.name = `FlowConsumedError`;
this.message = `This cold flow can only be consumed once. Use .sharedState() or .sharedEvent() to share cold flows.`;
}
}
exports.FlowConsumedError = FlowConsumedError;
/**
* Thrown when attempting to remove an observer from a flow was not added first.
*/
class FlowRemoveObserverError extends Error {
constructor() {
super(...arguments);
this.name = `FlowRemoveObserverError`;
this.message = `Tried to remove an observer from a flow that was not added first.`;
}
}
exports.FlowRemoveObserverError = FlowRemoveObserverError;
/**
* Thrown when attempting to emit, complete or error on an observer that was not observing.
*/
class ObserverError extends Error {
constructor() {
super(...arguments);
this.name = `ObserverError`;
this.message = `Tried to emit, complete or error on an observer that was not observing.`;
}
}
exports.ObserverError = ObserverError;
/**
* Thrown when attempting to emit or complete a completed flow.
*/
class HasCompletedError extends Error {
constructor() {
super(...arguments);
this.name = `HasCompletedError`;
this.message = `Tried to emit, complete or error on a completed observer.`;
}
}
exports.HasCompletedError = HasCompletedError;
/**
* Thrown when attempting to launch a coroutine in a scope that is finishing.
*/
class ScopeFinishingError extends Error {
constructor() {
super(...arguments);
this.name = `ScopeFinishingError`;
this.message = `Tried to launch new coroutine after scope marked as finishing.`;
}
}
exports.ScopeFinishingError = ScopeFinishingError;
//# sourceMappingURL=Errors.js.map