diff options
| author | binarycat <binarycat@envs.net> | 2025-03-24 17:31:39 -0500 |
|---|---|---|
| committer | binarycat <binarycat@envs.net> | 2025-03-24 17:31:39 -0500 |
| commit | 1af16cd135dd4e62f8e68abfb0587b57eb16ce6e (patch) | |
| tree | 14ccd4c4896e88b4c7d20b5fa4469db0a82c148e /src/librustdoc | |
| parent | 49bf6ca79eb7379e367578cba910d1e1cbacc7d1 (diff) | |
| download | rust-1af16cd135dd4e62f8e68abfb0587b57eb16ce6e.tar.gz rust-1af16cd135dd4e62f8e68abfb0587b57eb16ce6e.zip | |
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.
Diffstat (limited to 'src/librustdoc')
| -rw-r--r-- | src/librustdoc/html/static/js/search.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/librustdoc/html/static/js/search.js b/src/librustdoc/html/static/js/search.js index 1817d91af79..15bb3816f0b 100644 --- a/src/librustdoc/html/static/js/search.js +++ b/src/librustdoc/html/static/js/search.js @@ -2489,9 +2489,13 @@ class DocSearch { } } catch (err) { query = newParsedQuery(userQuery); - // is string list - // @ts-expect-error - query.error = err; + if (Array.isArray(err) && err.every((elem) => typeof elem == 'string')) { + query.error = err; + } else { + // rethrow the error if it isn't a string array + throw err; + } + return query; } if (!query.literalSearch) { |
