Skip to content

Commit adc2716

Browse files
authored
FIX: Invalid access error in logs (#1317)
1 parent c0a2d4c commit adc2716

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

lib/utils/search.rb

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,30 @@ def self.perform_search(
3434

3535
search_string = search_terms.join(" ").to_s
3636

37-
results = ::Search.execute(search_string, search_type: :full_page, guardian: guardian)
37+
begin
38+
results = ::Search.execute(search_string, search_type: :full_page, guardian: guardian)
39+
rescue Discourse::InvalidAccess => e
40+
return(
41+
{
42+
args: {
43+
search_query: search_query,
44+
category: category,
45+
user: user,
46+
order: order,
47+
max_posts: max_posts,
48+
tags: tags,
49+
before: before,
50+
after: after,
51+
status: status,
52+
max_results: max_results,
53+
}.compact,
54+
rows: [],
55+
instruction: I18n.t("invalid_access"),
56+
error: e.message,
57+
}
58+
)
59+
end
60+
3861
results_limit = max_results
3962

4063
should_try_semantic_search =

0 commit comments

Comments
 (0)