Skip to content

Commit 2d9f7b9

Browse files
authored
controllers/helpers/pagination: Add data access page link to high page offset error message (#7817)
1 parent 11a7308 commit 2d9f7b9

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/controllers/helpers/pagination.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,11 @@ impl PaginationOptionsBuilder {
103103
&& is_useragent_or_ip_blocked(config, req)
104104
{
105105
req.request_log().add("cause", "large page offset");
106-
return Err(bad_request("requested page offset is too large"));
106+
107+
let error =
108+
format!("Page {numeric_page} is unavailable for performance reasons. Please take a look at https://crates.io/data-access for alternatives.");
109+
110+
return Err(bad_request(error));
107111
}
108112
}
109113

src/tests/pagination.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ fn pagination_blocks_ip_from_cidr_block_list() {
2424
assert_eq!(response.status(), StatusCode::BAD_REQUEST);
2525
assert_eq!(
2626
response.into_json(),
27-
json!({ "errors": [{ "detail": "requested page offset is too large" }] })
27+
json!({ "errors": [{ "detail": "Page 2 is unavailable for performance reasons. Please take a look at https://crates.io/data-access for alternatives." }] })
2828
);
2929
}

0 commit comments

Comments
 (0)