-
Notifications
You must be signed in to change notification settings - Fork 212
show crates.io search errors to the user without logging them #2480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
instructions:
|
@rustbot claim |
When queries to `crates.io` API return errors, we will display them instead of logging them as errors. Closes rust-lang#2480
cc: @syphar, @GuillaumeGomez After a second take, I believe the I was thinking of creating a custom error response based on how it is constructed in if let Some(errors) = response.errors {
let messages: Vec<_> = errors.into_iter().map(|e| e.detail).collect();
bail!("got error from crates.io: {}", messages.join("\n"));
} My propose solution (This goes inside match get_search_results(&mut conn, ®istry, query_params).await {
Ok(result) => result,
Err(error) => {
// if we get an error from crates.io search api
if error.to_string().contains("got error from crates.io:") {
// Create a custom error response. Note: This would not report to Sentry
};
return Ok(custom_error.into_response());
}
// For other errors, propagate as usual
return Err(AxumNope::InternalError(error));
}
}
|
@byfnoel thank you for working on this! generally: differentating between error types should never be done via text matching. The cleanest way would be to introduce a new error type ( |
We are using the crates.io search API to power our own crate-search.
Sometimes the crates.io API returns 4xx or 5xx errors because of wrong queries or timeouts.
These errors can be shown to the user, but there is no need to report them to sentry or log them as errors.
We could add a new metric to track the amount of errors.
The text was updated successfully, but these errors were encountered: