Skip to content

Commit 0339115

Browse files
committed
report unsupported error when the feature is not available
1 parent b72543c commit 0339115

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

packages/db-client/src/streams/appendToStream/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { StreamsService } from "../../../generated/streams_grpc_pb";
2-
2+
import { StreamsServiceService} from "../../../generated/streams.v2_grpc_pb";
33
import { Client } from "../../Client";
44
import { ANY } from "../../constants";
55
import type {
@@ -11,6 +11,7 @@ import type {
1111
MultiAppendResult,
1212
AppendStreamRequest,
1313
} from "../../types";
14+
import { UnsupportedError } from "../../utils";
1415

1516
import { append } from "./append";
1617
import { batchAppend } from "./batchAppend";
@@ -87,5 +88,9 @@ Client.prototype.multiAppend = async function (
8788
requests: AppendStreamRequest[],
8889
baseOptions: BaseOptions = {}
8990
): Promise<MultiAppendResult> {
91+
92+
if (!(await this.supports(StreamsServiceService.multiStreamAppendSession, "all"))) {
93+
throw new UnsupportedError("multiStreamAppend", "25.10");
94+
}
9095
return multiAppend.call(this, requests, baseOptions);
9196
};

packages/db-client/src/streams/appendToStream/multi.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export const multiAppend = async function (
2222
"multiStreamAppend",
2323
(client) =>
2424
new Promise<MultiAppendResult>(async (resolve, reject) => {
25+
baseOptions.requiresLeader = false;
2526
const sink = client.multiStreamAppendSession(
2627
...this.callArguments(baseOptions),
2728
(error, response) => {

0 commit comments

Comments
 (0)