Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 1af16cd

Browse files
committed
search.js(query parser): rethrow error if it isn't a string array
only errors that are string arrays are intended to be shown to the user, other errors are bugs, and will be shown in the console as usual.
1 parent 49bf6ca commit 1af16cd

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/librustdoc/html/static/js/search.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2489,9 +2489,13 @@ class DocSearch {
24892489
}
24902490
} catch (err) {
24912491
query = newParsedQuery(userQuery);
2492-
// is string list
2493-
// @ts-expect-error
2494-
query.error = err;
2492+
if (Array.isArray(err) && err.every((elem) => typeof elem == 'string')) {
2493+
query.error = err;
2494+
} else {
2495+
// rethrow the error if it isn't a string array
2496+
throw err;
2497+
}
2498+
24952499
return query;
24962500
}
24972501
if (!query.literalSearch) {

0 commit comments

Comments
 (0)