Skip to content

Commit 32cd550

Browse files
committed
chore: use isError and delegate to super.handleError for generic error messages
1 parent 4a33fa8 commit 32cd550

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/tools/mongodb/search/listSearchIndexes.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,19 @@ export class ListSearchIndexesTool extends MongoDBToolBase {
5858

5959
protected handleError(
6060
error: unknown,
61-
{ database, collection }: ToolArgs<typeof DbOperationArgs>
61+
args: ToolArgs<typeof DbOperationArgs>
6262
): Promise<CallToolResult> | CallToolResult {
6363
if (error instanceof Error && "codeName" in error && error.codeName === "SearchNotEnabled") {
6464
return {
6565
content: [
6666
{
6767
text: "This MongoDB cluster does not support Search Indexes. Make sure you are using an Atlas Cluster, either remotely in Atlas or using the Atlas Local image, or your cluster supports MongoDB Search.",
6868
type: "text",
69+
isError: true,
6970
},
7071
],
7172
};
72-
} else {
73-
return { content: formatUntrustedData("Could not retrieve search indexes", EJSON.stringify(error)) };
7473
}
74+
return super.handleError(error, args);
7575
}
7676
}

0 commit comments

Comments
 (0)