ravendb
Version:
RavenDB client for Node.js
37 lines • 1.21 kB
JavaScript
import { throwError } from "../../Exceptions/index.js";
export class BulkInsertOperationBase {
_streamEnsured = false;
_bulkInsertExecuteTask;
_bulkInsertExecuteTaskErrored = false;
_operationId = -1;
async _executeBeforeStore() {
if (!this._streamEnsured) {
await this._waitForId();
await this._ensureStream();
this._streamEnsured = true;
}
if (this._bulkInsertExecuteTaskErrored) {
try {
await this._bulkInsertExecuteTask;
}
catch (error) {
await this._throwBulkInsertAborted(error);
}
}
}
async _throwBulkInsertAborted(e, flushEx = null) {
let errorFromServer;
try {
errorFromServer = await this._getExceptionFromOperation();
}
catch {
// server is probably down, will propagate the original exception
}
//TODO: use flushEx variable
if (errorFromServer) {
throw errorFromServer;
}
throwError("BulkInsertAbortedException", "Failed to execute bulk insert", e);
}
}
//# sourceMappingURL=BulkInsertOperationBase.js.map