Skip to content

Commit 7216ee9

Browse files
meili-bors[bot]flevi29Strift
authored
Merge #1848
1848: Remove hint about bad Meilisearch version r=Strift a=flevi29 # Pull Request ## What does this PR do? - removes added warnings for potential bad Meilisearch version - there are many more places these should be added otherwise, but that would be a lot of trouble to maintain and counter productive, so let's instead remove the outliers - it would also make my life easier with the upcoming #1825 ## PR checklist Please check if your PR fulfills the following requirements: - [x] Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)? - [x] Have you read the contributing guidelines? - [x] Have you made sure that the title is accurate and descriptive of the changes? Thank you so much for contributing to Meilisearch! Co-authored-by: F. Levi <[email protected]> Co-authored-by: Laurent Cazanove <[email protected]>
2 parents 05b1b2b + b2fdc16 commit 7216ee9

File tree

4 files changed

+14
-49
lines changed

4 files changed

+14
-49
lines changed

src/errors/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@ export * from "./meilisearch-api-error.js";
22
export * from "./meilisearch-request-error.js";
33
export * from "./meilisearch-error.js";
44
export * from "./meilisearch-timeout-error.js";
5-
export * from "./version-hint-message.js";

src/errors/version-hint-message.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/indexes.ts

Lines changed: 10 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,7 @@
55
* Copyright: 2019, MeiliSearch
66
*/
77

8-
import {
9-
MeiliSearchError,
10-
MeiliSearchRequestError,
11-
versionErrorHintMessage,
12-
MeiliSearchApiError,
13-
} from "./errors/index.js";
8+
import { MeiliSearchError } from "./errors/index.js";
149
import type {
1510
Config,
1611
SearchResponse,
@@ -373,22 +368,13 @@ class Index<T extends Record<string, any> = Record<string, any>> {
373368

374369
// In case `filter` is provided, use `POST /documents/fetch`
375370
if (parameters.filter !== undefined) {
376-
try {
377-
const url = `indexes/${this.uid}/documents/fetch`;
378-
379-
return await this.httpRequest.post<
380-
DocumentsQuery,
381-
Promise<ResourceResults<D[]>>
382-
>(url, parameters);
383-
} catch (e) {
384-
if (e instanceof MeiliSearchRequestError) {
385-
e.message = versionErrorHintMessage(e.message, "getDocuments");
386-
} else if (e instanceof MeiliSearchApiError) {
387-
e.message = versionErrorHintMessage(e.message, "getDocuments");
388-
}
389-
390-
throw e;
391-
}
371+
const url = `indexes/${this.uid}/documents/fetch`;
372+
373+
return await this.httpRequest.post<
374+
DocumentsQuery,
375+
Promise<ResourceResults<D[]>>
376+
>(url, parameters);
377+
392378
// Else use `GET /documents` method
393379
} else {
394380
const url = `indexes/${this.uid}/documents`;
@@ -601,19 +587,9 @@ class Index<T extends Record<string, any> = Record<string, any>> {
601587
: "documents/delete-batch";
602588
const url = `indexes/${this.uid}/${endpoint}`;
603589

604-
try {
605-
const task = await this.httpRequest.post(url, params);
590+
const task = await this.httpRequest.post(url, params);
606591

607-
return new EnqueuedTask(task);
608-
} catch (e) {
609-
if (e instanceof MeiliSearchRequestError && isDocumentsDeletionQuery) {
610-
e.message = versionErrorHintMessage(e.message, "deleteDocuments");
611-
} else if (e instanceof MeiliSearchApiError) {
612-
e.message = versionErrorHintMessage(e.message, "deleteDocuments");
613-
}
614-
615-
throw e;
616-
}
592+
return new EnqueuedTask(task);
617593
}
618594

619595
/**

tests/documents.test.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,7 @@ describe("Documents tests", () => {
172172
"getDocuments should have raised an error when the route does not exist",
173173
);
174174
} catch (e: any) {
175-
expect(e.message).toEqual(
176-
"404: Not Found\nHint: It might not be working because maybe you're not up to date with the Meilisearch version that getDocuments call requires.",
177-
);
175+
expect(e.message).toEqual("404: Not Found");
178176
}
179177
});
180178

@@ -191,8 +189,7 @@ describe("Documents tests", () => {
191189
} catch (e: any) {
192190
expect(e.message).toEqual(
193191
`Attribute \`id\` is not filterable. This index does not have configured filterable attributes.
194-
1:3 id = 1
195-
Hint: It might not be working because maybe you're not up to date with the Meilisearch version that getDocuments call requires.`,
192+
1:3 id = 1`,
196193
);
197194
}
198195
});
@@ -645,9 +642,7 @@ Hint: It might not be working because maybe you're not up to date with the Meili
645642
"deleteDocuments should have raised an error when the parameters are wrong",
646643
);
647644
} catch (e: any) {
648-
expect(e.message).toEqual(
649-
"Sending an empty filter is forbidden.\nHint: It might not be working because maybe you're not up to date with the Meilisearch version that deleteDocuments call requires.",
650-
);
645+
expect(e.message).toEqual("Sending an empty filter is forbidden.");
651646
}
652647
});
653648

@@ -662,9 +657,7 @@ Hint: It might not be working because maybe you're not up to date with the Meili
662657
"deleteDocuments should have raised an error when the route does not exist",
663658
);
664659
} catch (e: any) {
665-
expect(e.message).toEqual(
666-
"404: Not Found\nHint: It might not be working because maybe you're not up to date with the Meilisearch version that deleteDocuments call requires.",
667-
);
660+
expect(e.message).toEqual("404: Not Found");
668661
}
669662
});
670663

0 commit comments

Comments
 (0)