import { IterableX } from './iterablex.js'; class ThrowIterable extends IterableX { private _error: any; constructor(error: any) { super(); this._error = error; } *[Symbol.iterator](): Iterator { throw this._error; } } /** * Creates an async-iterable that throws the specified error upon iterating. * * @param {*} error The error to throw upon iterating the iterable. * @returns {AsyncIterableX} An iterable that throws when iterated. */ export function throwError(error: any): IterableX { return new ThrowIterable(error); }